Re:Django: What's new in 6.0 – Adam Johnson
by chistev on Tuesday December 09, 2025 @05:06PM
(#46211402)
But you could already reuse templates in Django by including them. What am I missing?
[ Parent
| on HN ]
Re:Django: What's new in 6.0 – Adam Johnson
by teagee on Tuesday December 09, 2025 @05:07PM
(#46211411)
Check 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/#rende...
Re:Django: What's new in 6.0 – Adam Johnson
by The_Fox on Tuesday December 09, 2025 @05:28PM
(#46211597)
I'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.
Re:Django: What's new in 6.0 – Adam Johnson
by adparadox on Tuesday December 09, 2025 @05:49PM
(#46211817)
I 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.
Re:Django: What's new in 6.0 – Adam Johnson
by WD-42 on Tuesday December 09, 2025 @06:46PM
(#46212274)
Partialdef 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.
Re:Django: What's new in 6.0 – Adam Johnson
by JodieBenitez on Wednesday December 10, 2025 @12:41AM
(#46214475)
It'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.