News for hackers. Stuff that matters.
Re:Second-Guessing the Modern Web by the__alchemist on Thursday September 21, 2023 @08:23PM (#37606313)
I love Django. I will be the first to throw spears at modern JS dev. Django's template language works well for simple cases. By design, it is restrictive compared to a proper programming language. I find this to be problematic.

For things beyond if/for statements, the solution is usually to write custom tags in a DSL that I have a hard time grokking. With JS, you can write arbitrary logic in an imperative language.

Re:Second-Guessing the Modern Web by simonw on Thursday September 21, 2023 @08:33PM (#37606390)
Personally I've come to prefer the design of Jinja, because it supports a larger set of Python syntax. I like that Jinja lets you use full Python expressions.

We designed Django (back in ~2003) with the idea that it should be usable by frontend developers who just worked in HTML and CSS, which isn't really a category that exists much today any more.

We used {% %} for tags rather than XML-style partly because we wanted the tags to remain visible in Dreamweaver!

Re:Second-Guessing the Modern Web by yawaramin on Friday September 22, 2023 @12:32AM (#37607897)
Nowadays I highly recommend HTML embedding libraries directly in the programming language. E.g. ScalaTags https://com-lihaoyi.github.io/scalatags/ or (my own) https://github.com/yawaramin/dream-html

Yes, you give up the ability of designers and frontend-only people to easily work with the HTML templates. But in exchange you get quite a lot.

Re:Second-Guessing the Modern Web by lpcrealmadrid on Thursday September 21, 2023 @08:34PM (#37606405)
Came here to agree with this. Beyond basic conditionals and loops, Django templates get really hard to read IMO. Combine that with “sprinkling in” some HTMX and Alpine and you’ve got the making of a true headache that no one wants to work with, even though it technically gets the job done