Precisely! Why not such a tags already exists in DTL? I see people reimplement this again and again, why let people constantly reinvent the wheel?
Or better: allow people to create common Python iterables in templates. Really I don’t understand the opposition other than pure ideology. Since the starting of this discussion, I have seen any good reason to not let people create dicts in DTL other that “it’s like that and ti’s always been like this”. And it’s honestly getting frustrating.
Yes, the whole discussion is frustrating I grant you. The DTL has a specific philosophy that is made clear — to keep programming construct out of template, which leads to cleaner, more testable, more maintainable code — and yet again and again and again, without accepting the answers given, folks keep asking “Can we turn it into a half-baked Jinja?”
Surely it’s not so hard to see why that solution suits no-one?
The tags maintained in Django itself cover more than the 90% use case. We don’t add everything because there’s no end to that. It become unmaintainable. Adding tags to your own project is no problem. Share them if you think they’re truly useful.
If you want actual advice, try leaning into the DTL’s way of doing things. The water is nice. You might find you like it.
I agree in principle with you that DTL are weirdly crippled. But I don’t really see the big use of creating iterables/dicts specifically.
Both those examples you gave are about under powered form libraries not being able to configure attributes, which is imo better solved by better and higher abstractions (like iommi’s attrs feature for forms, tables, fragments, etc).
Unfortunately, {% spaceless %} is a massive destruction weapon. It remove each and every blank line, which is not what you want when formatting pure text. I ended-up writing my own tag for this which was uselessly tedious and produces highly difficult to read templates where -%} would have been way lighter.
In my experience {% spaceless %} always does something no one expects (insert monty python joke here). I keep forgetting what it does and trying to use it only to be surprised and reverting the change. I can’t even remember what it does not except that it’s wrong/useless (for every case I’ve heard about).