Ticket #5865: cycle-doc.diff
File cycle-doc.diff, 1.2 KB (added by , 17 years ago) |
---|
-
docs/templates.txt
591 591 ~~~~~ 592 592 593 593 **Changed in Django development version** 594 Cycle among the given strings or variableseach time this tag is encountered.594 Cycle among the given strings, variables, iterable type each time this tag is encountered. 595 595 596 596 Within a loop, cycles among the given strings/variables each time through the 597 597 loop:: … … 621 621 comma-based syntax exists for backwards-compatibility, and should not be 622 622 used for new projects. 623 623 624 In case you pass a single value which is an iterable variable defined in the context cycle iterates over its values. 625 Example context definition:: 626 627 {'colors': ['red', 'blue', 'green']} 628 629 Example usage:: 630 631 {% for row in mydata %} 632 <tr class="{% cycle colors %}">...</tr> 633 {% endfor %} 634 635 {% for row in mydata %} 636 <tr class="{% cycle colors as color%}">...</tr> 637 {% endfor %} 638 639 <tr class="{% cycle colors as color %}">...</tr> 640 <tr class="{% cycle color %}">...</tr> 641 <tr class="{% cycle color %}">...</tr> 642 643 624 644 debug 625 645 ~~~~~ 626 646