Hi there,

I propose a feature which we already discussed a bit before 1.0 in
ticket #6398 [1]. It's about a small enhancement to the "for" template
tag that would allow users to specify a default item to be shown in
case the given iterable is empty.

Currently that's also possible with this:

{% if grocery_list %}
  {% for item in grocery_list %}
    {{ item }}
  {% endfor %}
{% else %}
  Nothing to buy.
{% endif %}

The proposed feature would allow this:

{% for item in grocery_list %}
  {{ item }}
{% default %}
  Nothing to buy.
{% endfor %}

I believe it would allow template authors to produce cleaner templates
since it prevents repetition of if statements a lot.


Cheers,
Jannis

1: http://code.djangoproject.com/ticket/6398


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to