summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-07-26 22:09:43 +0000
committerMalcolm Tredinnick <malcolm.tredinnick@gmail.com>2008-07-26 22:09:43 +0000
commite29aece743df644cdaa7d8506c6491ac9c1db061 (patch)
tree57f7d6046d9c39bca31e04621b4a630b3ac7120d /docs
parentf763ff4d02b5c99bdb1ebaf63967a24d8e8447ac (diff)
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
Diffstat (limited to 'docs')
-rw-r--r--docs/templates.txt13
1 files changed, 13 insertions, 0 deletions
diff --git a/docs/templates.txt b/docs/templates.txt
index d3ec139f06..4bf8214a2a 100644
--- a/docs/templates.txt
+++ b/docs/templates.txt
@@ -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
~~~~~~~