Hello,

while I'm working with Jinja2 I noticed, that Twig (a PHP templating engine) uses virtually the same template syntax, but additionally offers a handy feature in case a list of a for-loop doesn't contain any entries:

{% for user in users %}
    * {{ user.name }}
{% else %}
    No user have been found.
{% endfor %}

How is it supposed to be done in Jinja2? At least the documentation doesn't mention an else-directive for the for-loop. An outer if-condition would probably work, but wouldn't look very elegant.

Kind regards
Marten

--
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.

Reply via email to