Code

Ticket #10704: ifchanged-else-docs.diff

File ifchanged-else-docs.diff, 738 bytes (added by Tarken, 5 years ago)
Line 
1Index: docs/ref/templates/builtins.txt
2===================================================================
3--- docs/ref/templates/builtins.txt     (revision 10369)
4+++ docs/ref/templates/builtins.txt     (working copy)
5@@ -330,6 +330,19 @@
6             {% endifchanged %}
7         {% endfor %}
8 
9+The ``ifchanged`` tag can also take an optional ``{% else %}`` clause that
10+will be displayed if the value has not changed:
11+
12+    {% for match in matches %}
13+        <div style="background-color:
14+            {% ifchanged match.ballot_id %}
15+                {% cycle red,blue %}
16+            {% else %}
17+                grey
18+            {% endifchanged %}
19+        ">{{ match }}</div>
20+    {% endfor %}
21+
22 .. templatetag:: ifequal
23 
24 ifequal