Re:Why Django Sucks, and How we Can Fix it [slides]
by metamemetics on Thursday September 09, 2010 @04:20AM
(#1674762)
I think if your writing more than a couple template tags and for simple things you're doing it wrong. I would really limit templates to being primarily HTML. Put any advanced python functionality in your view function, Django templates are minimal and not for making queries like other templating systems (a good thing IMO). If you need to do anything crazy advanced like recursively display stuff for items, don't write a template tag, use a simple include tag to insert HTML for subelements. Using the include tag when possible is also great for AJAX, as you have the HTML for a subelement sitting in a file if you want to render just that to return to a XML request.
Re:Why Django Sucks, and How we Can Fix it [slides]
by zeemonkee on Thursday September 09, 2010 @04:46AM
(#1674799)
OK, come back when you have done something moderately more "crazy advanced" than recursion.
> not for making queries like other templating systems
WTF ?
Re:Why Django Sucks, and How we Can Fix it [slides]
by metamemetics on Thursday September 09, 2010 @05:45AM
(#1674897)
I was not implying that the concept of recursion is at all advanced. I was implying that the problems to be solved in the template layer are very simple.
I won't be able to come back to you because it would be too inefficient doing something more advanced than that in the template layer. Because rather than write the python to write template syntax to be interpreted back into python, I simply wrote the logic in one-pass python in the view function. It's more direct, runs faster, and your templates are clearer to designers if you're working in a group project.
It's the restrictiveness compared to e.g. Jinja2 or Mako. With those engines, I can just drop in a Python function and be done with it; with Django template engine you end up writing tons of template tags for the simplest things. It's designed for a particular work environment (designers work on templates, so should not be allowed to do anything dangerous) that I've found to be quite rare in most projects.