Specifically, you might look at http://www.djangosnippets.org/snippets/9/.
This allows you to do something like:
{% expr candidate.vote_set.filter(vote='TU').count() as count %}
and now {{count}} can be used in the current context.
If you find yourself yearning for Total Python Power in your
templates, you might consider using a different templating system.
Note: I have not used either of these, but I am starting a new project
next month and will be taking a hard look at both of them.
Jinja (http://jinja.pocoo.org/) is, by design, very similar to
Django's template syntax. It compiles the templates to Python code for
speed. I particularly like its support for macros with arguments.
There is also Mako (http://www.makotemplates.org/).
Here is a snippet that shows how to integrate Mako with Django.
http://www.djangosnippets.org/snippets/97/
HTH,
Peter
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---