1
0
mirror of https://github.com/django/django.git synced 2025-10-24 06:06:09 +00:00

Fixed #4534 -- Added an "else" option to the "ifchanged" template tag.

Patch from SmileyChris.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@8095 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick
2008-07-26 22:09:43 +00:00
parent f763ff4d02
commit e29aece743
3 changed files with 43 additions and 16 deletions

View File

@@ -828,6 +828,19 @@ The 'ifchanged' block tag is used within a loop. It has two possible uses.
{% endifchanged %}
{% endfor %}
The ``ifchanged`` tag also takes an optional ``{% else %}`` clause that will
be displayed if the value has not changed::
{% for match in matches %}
<div style="background-color:
{% ifchanged match.ballot_id %}
{% cycle red,blue %}
{% else %}
grey
{% endifchanged %}
">{{ match }}</div>
{% endfor %}
ifequal
~~~~~~~