Ticket #10704: ifchanged-else-docs.diff

File ifchanged-else-docs.diff, 738 bytes (added by Joey Wilhelm, 15 years ago)
  • docs/ref/templates/builtins.txt

     
    330330            {% endifchanged %}
    331331        {% endfor %}
    332332
     333The ``ifchanged`` tag can also take an optional ``{% else %}`` clause that
     334will be displayed if the value has not changed:
     335
     336    {% for match in matches %}
     337        <div style="background-color:
     338            {% ifchanged match.ballot_id %}
     339                {% cycle red,blue %}
     340            {% else %}
     341                grey
     342            {% endifchanged %}
     343        ">{{ match }}</div>
     344    {% endfor %}
     345
    333346.. templatetag:: ifequal
    334347
    335348ifequal
Back to Top