Re: Optional else block in for

2008-03-31 Thread Evert Rol
Perhaps this is useful: http://www.djangosnippets.org/snippets/546/ It even has a ticket: http://code.djangoproject.com/ticket/6398 with, of course, ensuing discussion. > > I was looking at jinja[1] and there was one feature which I really > liked > "for loops have an optional else block exe

Optional else block in for

2008-03-31 Thread shabda
I was looking at jinja[1] and there was one feature which I really liked "for loops have an optional else block executed if there was no iteration." Right now most of my for loops are like, {% if comments %} {% for comment in comments %} {{comment}} {% endfor %} {% else %} There are no comment