feat(for): Allow iterating over dictionary key and value

Closes #94
This commit is contained in:
Kyle Fuller
2017-04-19 00:03:47 +01:00
parent a8d680b30e
commit 89256b96f4
5 changed files with 61 additions and 6 deletions

View File

@@ -19,7 +19,17 @@ A for loop allows you to iterate over an array found by variable lookup.
{% endfor %}
</ul>
The ``for`` tag can contain optional ``where`` expression to filter out
The ``for`` tag can iterate over dictionaries.
.. code-block:: html+django
<ul>
{% for key, value in dict %}
<li>{{ key }}: {{ value }}</li>
{% endfor %}
</ul>
The ``for`` tag can contain optional ``where`` expression to filter out
elements on which this expression evaluates to false.
.. code-block:: html+django