﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
6398	Add optional {% default %} clause to {% for %} template tag	Jannis Leidel	Jannis Leidel	"As [http://simonwillison.net/2008/Jan/16/django/ requested by Simon] I propose an {{{{% else %}}}} tag for the {{{{% for %}}}} template tag which could be used like this:

{{{
from django.template import *
>>> t1 = Template(""""""
    {% load mytags %}
    {% for athlete in athlete_list %}
        {{ athlete }} 
    {% else %}
        No athlete in list!
    {% endfor %}
    """""")
>>> c1 = Context(
    {'athlete_list':
        ['me', 'myself', 'I']
    })
>>> t1.render(c1)
u'me myself I '
>>> c2 = Context({})
>>> t1.render(c2)
u'No athlete in list!'
}}}

For a standalone version look at http://www.djangosnippets.org/snippets/546/
"		closed	Template system	dev		fixed	easy-pickings		Accepted	1	0	0	0	0	0
