Optimizing remote work: Pull Requests, Stand-ups, and emojis with Kasey Kelly
Published December 6, 2024
This video features Kasey Kelly at DjangoCon US 2026 in Chicago, Illinois, USA.
Most Django teams treat their templates as second-class citizens.
Logic gets carefully organized into models, views, and services, then dumped into a {% include %} chain that nobody fully understands six months later. Context variables appear from nowhere, component boundaries exist only in the original author's memory, and the onboarding docs are "just ask someone."
This talk argues that your templates deserve the same respect as the rest of your stack and shows you how to get there without abandoning Django's template system or adding a heavy JavaScript build pipeline.
We'll cover the component mental model in plain Django, an honest assessment of your tooling options (built-in includes, django-includecontents, django-cotton, and more), and how to know when a plain {% include %} is still the right answer. We'll close with pattern libraries and how explicit component contracts make AI-assisted development dramatically more reliable.
Attendees leave with a concrete sense of best practices they can apply to a new project or use to incrementally improve an existing one. No headless architecture required.
This talk was presented by Kasey Kelly at DjangoCon US 2026 in Chicago, Illinois, USA
https://2026.djangocon.us/talks/taming-your-templates-component-based-frontends-in-django/
Automatically transcribed, so expect mistakes in names and technical terms.
Speaker 1: All right, thank you. I'm Casey Kelly, Director of User Experience at Lincoln Loop. We design, build, and support platforms that are too important to fail. We've worked with companies like Smithsonian, the Wharton School of Business, Planned Parenthood, and Mozilla. So just a quick bit about me. I started working in Django in 2010. And I've been with Lincoln Loop since 2015. I've designed and built design systems and component libraries for some of our largest accounts. building resilient front ends that reach millions of visitors. Some of these projects are brand new and some of these projects are still in use over a decade later. So I'm really proud of the team that we've built and
Speaker 1: the work that we do together. So let's talk templates. This is a conversation that comes up every couple of years. So first let me say this. I could spend this entire talk writing a love letter to Django templates. The system is easy to take for granted, nearly two decades on, but when this designer was introduced to Django in its early days, I had been wrestling with PHP spaghetti in WordPress. So the early days of Django really were kind of an era of there has to be a better way across so many different areas of this industry. These techniques were really innovative and special at the time.
Speaker 1: It only took me a few minutes to wrap my head around this. It's an easy-to-parse syntax for template inheritance and data injection. This was such a breath of fresh air. And not long after, we entered an age of JavaScript for everything. React, View, etc. solved a real need at the time. And there's still a place for fully reactive systems like that. But in some ways, we overcorrected a bit and we took for granted some of the important batteries-included bits of Django. Now, there are good reasons for JavaScript heavy systems, and there are things that we can learn from them in our work. For example, if you look at this
Speaker 1: example code here, you can tell what is a custom component. You know, with the capital letters, we've got the button and the pros. You can tell what is standard HTML with the divs and the full class list, and it doesn't get in the way. And then you've got uh special syntax for conditionals. And you can tell what your key value pairs are, where your data is coming from. This is just really clean and you can tell exactly what's going on on the front end. And now it's 2026 and the pendulum has swung a bit. It's pretty nice, as it turns out, to send compiled HTML down over the wire. Not every blog post has to be a 10 megabyte React app fetching content via an API call.
Speaker 1: We can even add isolated bits of real-time data and interactivity with progressively enhanced snippets of JavaScript on the page with tools like HTMX and Alpine. So our HTML has gotten a lot smarter. For that matter, we can even inject inline styles with Tailwind into our HTML using JavaScript That compiles JavaScript templates into HTML on the server in a way that sends HTML to the browser and obscures the fact that JavaScript ever existed. The future is here. Now look, I'm not here to pine for the days of table layouts and FTP uploads, though I do miss a good flash animation.
Speaker 1: There we go. Back to twenty twenty-six. But seriously though, back to 2026. Because we've figured a lot of things out. We've paved the cow paths, we've established good patterns. We have a lot of different tools to solve a lot of different problems. And it can be hard to land on the correct one. So how can we take what we've learned and use the right tools for the job? After nearly 20 years, we've learned that there is no silver bullet. There are trade-offs to every tool. Some allow for easier documentation systems. Some allow for more sophisticated component-driven development, and some are more easily portable outside of the Django ecosystem.
Speaker 1: So let's take a look at some examples. First, let's revisit Django's first party solution. For as much as it gets right, this is a 25-minute talk. So I'm going to dive right into the first time I thought, man, this is ugly. And I'm allowed to say that because this is my code. There's nothing technically wrong with it. It's not bad. It works. And this actually still lives in production today. But this is unrevised and honest. After working in JavaScript land for a while, the lack of a proper component system can sort of feel like typing with your fingers taped together. So let's take a look at this. First of all, there are no line breaks. I understand why that decision was made, but that doesn't make it less painful when you're actually working with it.
Speaker 1: It's not type safe. If you're used to working with front-end tests, this can feel risky to work with. And there are lots of reasons why this is important. I think we all know how valuable Django's database guardrails are. It's one of the earliest features of the framework that you can't put a string in a number field for all sorts of reasons. Many of the same reasons apply to the front end. For example, you don't want a string to end up in a math equation in your JavaScript. So adding a layer of data type safety allows for more confident front ends. So you can see in this include you just have strings and data. Next, you can only pass in flat context. There are no children or
Speaker 1: more than very flat chunks of data. So overall, this already feels like an abuse of the include pattern. And you know, there are worse examples out here than mine too. It can feel like the Wild West. Or maybe more accurately, the Wild West. Or even this wild west. So what can we do? With how much care and craft goes into my components, the actual use of these components doesn't instill confidence. There are a lot of different approaches for solving this problem, so let's take a look at some. First though, a brief aside about partials. These solve a completely different problem than my focus here today.
Speaker 1: Partials are much closer to ging macros. It's more about requesting small bits of a file from the server. So just as an example, picture the refresh action in Gmail, whether that's a button or you know on a timed thing. Uh the Gmail app is huge and you only want to add one row at the top uh on refresh. So before partials, your options were One, something other than Django. You use Django for the API layer and you have some other system to manage your your truly reactive templates. Or two, you have a hard refresh on the page. So partials allow you to say refresh this data using only small chunks of this template. So it just kind of allows you to be a bit more surgical
Speaker 1: Or even when you click on an item, injecting a small template into that same display in the message. So HTMX and partials allow you to do this from your Django templates. Okay, so back to components. For the purpose of this demo, we're going to look at a simple familiar pattern. This is the humble card list. So let's first look at the templates. We'll start with what it looks like in native Django with Wagtail. This is the card itself. So we have the HTML and a couple of uh data snippets with the a the headline in the text and then a custom Django tag, this is Wagtail native. So you've got the image tag there, it's very common.
Speaker 1: So that's that's your card template, and this looks completely fine as a component. But next up you have the list component that includes it. So notice how the data arrives here. You've got the width headline equals card dot headline. So far it's pretty straightforward. Um but this is this is just the card list template, which you're going to include again in this file, which is the parent template. So you don't have any idea what's inside the card list template here. You have to do a little bit of archaeology to figure that out. In your data, it's not clear that blocks. value dot cards has anything to do with the content inside it. So this this just isn't ideal. So the first thing that we, the first uh package that I'm going to look at to solve this is Django Include
Speaker 1: Contents by our own Chris Bevan. Also known as Smiley Chris on GitHub. It's a component system built on top of Django templates, and it also fully supports Jinja. So it's easy to sprinkle in to most existing Django projects. The history of this project is in the name. Initially, the goal was just to build a template tag for slot-like functionality, which is the biggest pain point of includes. But then it evolved into a proper component system. It doesn't try to replicate React or interfere with JavaScript and CSS bundling. The goal here is to rethink the Django Include in a way that feels more native to modern component-driven workflows. So first to install the package, it's a quick change to your site settings.
Speaker 1: So you can see there at line 70, it's just a swap out for the back end. And it fully extends the Django template language. So anything you can do in Django, you can do here. So let's get into this template. With include contents, the card looks the same with the exception of the props line at the top there. So you get a little bit more of that type safety. Then the card list template is a little simpler than it was before because you've got that content slot, which is just the default um for oh uh if if your include has one slot then you don't need to name it um And then both templates can be called from the parent template at the same time. So this is where it really starts to shine. So you can see at line nine, you've got the card list, and then that's
Speaker 1: Inside that block, you have the for loop and then the include with what that data looks like. So you can read everything right here. You can tell exactly what's going on. You can tell which are the custom components, which is the normal HTML, etc. So this is just much cleaner, much more friendly. There are a lot of different packages that do technically similar things, which is just to provide some additional features on top of Django templates or Jinja. So I'll briefly show a couple of others here so you can see the variety of syntaxes that have been used to solve this problem. The first up is Django Cotton. Include contents takes a very similar approach to this. So the code might feel familiar if you've worked with that package.
Speaker 1: So you can see the usage there. You get the C dash that indicates The component in the way that include contents uses include colon. So they're very similar approaches there There are some syntax differences and a couple of features that aren't one-to-one. I haven't personally used cotton because my recent project had a ginger requirement, which cotton doesn't yet support, but it's a it's a perfectly good package. The next I'm I'm going to show off here is slippers. Um this one looks a little more like native Django template tags One of the big differences here is components are registered in a components. yaml file and then called with template tags. So it does require that extra layer of configuration. Next up we've got Django View Component
Speaker 1: based on the Rails way of building components. This is for the crowd that might think, wouldn't it be great if everything were actually Python? Not for me, but I can see how some folks might find that compelling. So there are others, but I picked these to show off because they show the most variety in the approaches. So you can see that folks are trying to solve this problem in a number of different ways. One more thing to mention here is includes are relatively expensive when it comes to server requests. So if you've got a page that has a ton of includes in it and you're running into performance bottlenecks , it might be worthwhile to either flatten those out, get rid of the includes again. for performance reasons
Speaker 1: or put a cache layer on it. If you've got a page that is fairly static, you can cache it, you know, forever. And um so there are trade-offs there to everything. So just something to keep in mind. So I mean just keep in mind the fastest templates are the flattest templates. So the more complexity you add, the more um hit that's going to be on the server. Okay, let's talk documentation. Docs ought to be a consideration anytime a project is expected to outlive the original author. The system we've landed on for front-end documentation in Django most recently is Django Pattern Library by the folks at Torchbox. This is what we're using on the Firefox site that we just launched this year.
Speaker 1: So it's essentially the docs system is a static site. but it still uses Django for routing and so it is uh tapping into the Django template library in order to um build these pages You can also see here that we're using the includes content library. So that code looks familiar, it's very small, but that's what we just looked at. So the data for this pattern library lives in YAML files in a dedicated pattern library directory This is actually really nice for docs. It keeps docs out of the database migrations. You can use predictable content for front-end tests. So if you've got CMS data coming in and um You've got front-end tests that might break because somebody changed some text somewhere.
Speaker 1: You want those things to kind of live in separate places In the Mozilla instance, we're using a separate pattern library, HTML file, to reference the main component file We figured this was more useful to show how the component was going to be used rather than show the component code itself in the documentation system. So that also allows us to keep the main component file as the source of truth. And both Wagtail and the pattern library reference the same code, which is very important to make sure your docs don't start to get stale. This also allows us to build things like full page mockups in the documentation system and not have to worry about touching Wagtail or anything for that. So it's nice for handoff for lots of different reasons.
Speaker 1: But you can do it either way. So for this demo that I put together, I did it the other way. So you can see here the template source code is the actual component code itself. So that's one less HTML file in your repo. But it's a little less uh uh rigid. So with the pattern library, it's still a nice way to keep the front-end documentation out of the back end Front-end devs can still use this system to hand off work to the back-end folks. And we still use the pattern library to run playwright visual regression tests. But in this instance, it's just a static site. So that kind of thing needs to be configured manually. This system's great, but there are more sophisticated tools for documentation in the JavaScript ecosystem.
Speaker 1: So I'll get into those briefly in the next section. Finally, I'll add that as the Firefox project has matured, we've had more and more reason to treat the real system as the source of truth. So we have a separate set of documentation that's used that's generated at build time from Wagtail fixtures. So these are actual Wagtail pages that are generated with a management command. So the back-end team can provide easy demos of new Wagtail features that they're working on and then run the backend tests against predictable pages again. Because you could technically go in and edit these pages in Wagtail, but every time the database is dumped, it will regenerate from scratch. So that's been quite handy as well.
Speaker 1: Okay, the next example I'm going to show is Wagtail Pippet. This is the completely abandoned Django templates approach. So I'm not going to go too deep here, but this is just another solution. So this is nice if you have a more JavaScript focused team or if you want to use your front end on top of various different back ends, such as like static landing pages or one-off proprietary CMS projects. Some people have, you know, Salesforce landing pages and that sort of thing. So you can use your front end as the source of truth for multiple different um deployments. So this project also aims to allow smarter asset bundling on a per page basis, similar to what you kind of take for granted in a full um Webpack or VET or
Speaker 1: you know SPA project where you get those like isolated special Snowflake CSS and JavaScript bundles that are just what you need for that exact page. Wagtail Pippit provides that functionality using the components that you're building with Wagtail, and then it it bundles all that together with Python. So if you're familiar with React, you should feel right at home here. And notice the JavaScript and CSS imports like I just mentioned. So, if you're using a proper JavaScript front end, you can use Storybook for your documentation. This is an amazing tool where you can manipulate the data and see how the components react in real time.
Speaker 1: You can change viewports, dark mode, light mode, etc. You can work interactivity into the docs in ways that are helpful to your editors. For example, this is a card list, um, and you can see the only uh interactivity that I have in the docs here is you can add up to six cards. So you can see how the card list is going to look with one card or five cards, see how it wraps, etc. So you can just be really deliberate about how you build your docs this way. Storybook also has accessibility tools, visual regression tests, etc. built in. So this is super nice. The important thing to note here is Storybook is a really awkward fit for Django templates. Because Django templates are not type-safe in a default way. Any attempt at getting the Django template language into Storybook means that you're adding a lot of extra scaffolding to every story because Django templates don't provide enough data context on their own.
Speaker 1: You end up duplicating data configuration that already exists in Python. That said, the folks at uh Torchbox are also working on Storybook Django, which uses the Django pattern library data uh you know the YAML files and injects that into storybooks. So it's labeled as experimental and it only works with vanilla Django at the moment. So if you try to use include contents or cotton or something, you'll have trouble and you'll need to work that type of thing in yourself. But it's great to see that there are folks trying to solve these problems. So we've talked about why component systems are important, and we've gone over a handful of ways to make this easier. If I can offer any sort of advice here, it's that projects can become brittle.
Speaker 1: When you are fighting against frameworks. So if you're building with React, do things the React way. If you're starting with Django templates, use tools that enhance the language. and will be easy to pick up for others who walk into the project expecting to see Django templates. Nothing we build exists in a vacuum. And often these decisions are made because of the other people. who are going to be working on these projects with you or after you, and that's completely okay. So if nothing else, be kind to your future self when you're making these calls. So let's keep building great things together. Thank you. Do we have time for questions?
Speaker 1: Okay. Any questions? What's all the screen? Register for our social uh Wednesday Wednesday night after closing remarks. Uh we're gonna have a ping pong party at a ping pong bar. So that'll be fun. Uh but there are limited limited seats. So register ahead of time. We'd love to see you there. All right. Uh
Speaker 2: would you recommend from a maintainability standpoint if you have a product that's still alive but olding using the old template system to upgrade it? Or would you say it's it's not worth the
Speaker 1: No that's a good question. One of the nice things about a lot of these systems that I showed is they work on top of Django. So you can inject them and start using them a little bit at a time. So you can say, you know, take an old project that's been around forever and I'm going to, you know, work on one feature, one landing page and start to Just experiment a little bit. So yeah, it doesn't have to be a throw the baby out with the bathwater. So that's that's one of the nice things about these Cool, thank you.
August 24 - 28, 2026
Chicago, Illinois, USA
Note: We understand that names change, people change, and bodies change. We respect each individual's journey and privacy. If you have any concerns about a video or need us to remove content, please don't hesitate to contact us. We will handle your request with care and promptly address any issues.
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026
Published October 26, 2026