3 ms·
But you could already reuse templates in Django by including them. What am I missing?
by chistev 11mo ago
But you could already reuse templates in Django by including them. What am I missing?
- teagee 11mo agoCheck out the HTMX example in the blog, this helped me better understand how it could be used https://adamj.eu/tech/2025/12/03/django-whats-new-6.0/#render-partials-in-isolation https://adamj.eu/tech/2025/12/03/django-whats-new-6.0/#rende...
- The_Fox 11mo agoI'm an avid HTMX user but never did I ever think "I'm using so many includes, I wish I didn't have to use include so much." What I would like is a way to cut down the sprawl of urls and views.
- adparadox 11mo agoI do a check for `request.htmx` in my views and conditionally return a template partial as needed. This reduced my need for one-off view functions that were only returning partials for htmx. Works pretty well from my experience.
- WD-42 11mo agoPartialdef inline is the real win. Lets you define parts of a page without needing to place them in another file. Reduces the mental overhead of imagining how the inclusion will look because it’s already there. The use case is mainly driven by htmx where you will have lots of these partials and the view code renders them as individual responses.
- JodieBenitez 11mo agoIt's just syntactic sugar, making life a bit easier for HTMX users (cf. "htmx was the main motivation for this feature"). I'm using Unpoly and I just render the whole page and let Unpoly swap the content according to the target selectors, so no need for this. Not much difference in perf if you dont generate gigantic pages with heavy header/footer.