Le 05/04/2011 01:23, Zygimantas a écrit :
{% for item in [RANGE?] if items|length % 5 %}
Hi,
See the docs for the list of global filters, tests and functions:
http://jinja.pocoo.org/docs/templates/#list-of-builtin-filters
The range() function in particular is there. It behaves the same as in
Python.
The slice() filter does a bit more than your use case, but it would work
too: items|slice(5, fill_with='')
More generally when something is hard to do in Jinja you can either do
it in Python before rendering, or add helpers in the jinja_env.filters
or jinja_env.globals dicts.
Regards,
--
Simon Sapin
http://exyr.org/
--
You received this message because you are subscribed to the Google Groups
"pocoo-libs" 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/pocoo-libs?hl=en.