←back to thread

378 points rbanffy | 2 comments | | HN request time: 1.357s | source
Show context
giancarlostoro ◴[] No.46210692[source]
Template partials look good, which is one of the key reasons frameworks like React are as good and popular as they are, because you can reuse small segments of code.
replies(8): >>46211187 #>>46211247 #>>46211354 #>>46211402 #>>46211982 #>>46212701 #>>46212849 #>>46213424 #
chistev ◴[] No.46211402[source]
But you could already reuse templates in Django by including them. What am I missing?
replies(3): >>46211411 #>>46212274 #>>46214475 #
teagee ◴[] No.46211411[source]
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...

replies(1): >>46211597 #
1. The_Fox ◴[] No.46211597[source]
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.

replies(1): >>46211817 #
2. adparadox ◴[] No.46211817[source]
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.