Ticket #7935: templates.diff

File templates.diff, 955 bytes (added by james Turnbull, 16 years ago)
  • docs/templates.txt

     
    701701
    702702You can loop over a list in reverse by using ``{% for obj in list reversed %}``.
    703703
    704 **New in Django development version**
    705 If you need to loop over a list of lists, you can unpack the values
    706 in eachs sub-list into a set of known names. For example, if your context contains
    707 a list of (x,y) coordinates called ``points``, you could use the following
    708 to output the list of points::
     704**New in Django development version**: If you need to loop over a list of lists,
     705you can unpack the values in each sub-list into individual variables. For
     706example, if your context contains a list of (x,y) coordinates called ``points``,
     707you could use the following to output the list of points::
    709708
    710709    {% for x, y in points %}
    711710        There is a point at {{ x }},{{ y }}
Back to Top