Skip to content

Commit a976542

Browse files
committed
📝 Add loop.parent explanations
1 parent da8bd40 commit a976542

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

doc/tags/for.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Variable Description
6565
``loop.first`` True if first iteration
6666
``loop.last`` True if last iteration
6767
``loop.length`` The number of items in the sequence
68-
``loop.parent`` The parent context
68+
``loop.parent`` The parent loop context, for example ``loop.parent.loop.index``
6969
===================== =============================================================
7070

7171
.. code-block:: twig
@@ -74,6 +74,12 @@ Variable Description
7474
{{ loop.index }} - {{ user.username }}
7575
{% endfor %}
7676
77+
{% for user in users %}
78+
{% for right in user.right %}
79+
{{ loop.parent.loop.index }} - {{ user.username }} - {{ right }}
80+
{% endfor %}
81+
{% endfor %}
82+
7783
.. note::
7884

7985
The ``loop.length``, ``loop.revindex``, ``loop.revindex0``, and

0 commit comments

Comments
 (0)