Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Update docs/templates.rst #159

merged 1 commit into from

2 participants


Docs: When we use a loop recursively, loop refers only to the innermost (closest) loop.

@myle myle Update docs/templates.rst
Loop (recursive) --> Another loop -> loop(...)
@mitsuhiko mitsuhiko merged commit 7e2b823 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 1, 2012
  1. @myle

    Update docs/templates.rst

    myle authored
    Loop (recursive) --> Another loop -> loop(...)
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 0 deletions.
  1. +4 −0 docs/templates.rst
4 docs/templates.rst
@@ -588,6 +588,10 @@ The following example implements a sitemap with recursive loops::
{%- endfor %}
+The `loop` variable always refers to the closest (innermost) loop. If we
+have more than one levels of loops, we can rebind the variable `loop` by
+writing `{% set outer_loop = loop %}` after the loop that we want to
+use recursively. Then, we can call it using `{{ outer_loop(...) }}`
Something went wrong with that request. Please try again.