summaryrefslogtreecommitdiff
path: root/docs/ref
diff options
context:
space:
mode:
Diffstat (limited to 'docs/ref')
-rw-r--r--docs/ref/templates/builtins.txt21
1 files changed, 21 insertions, 0 deletions
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt
index 48412239ad..d8f76dc680 100644
--- a/docs/ref/templates/builtins.txt
+++ b/docs/ref/templates/builtins.txt
@@ -1433,6 +1433,27 @@ then the output would be:
{'name': 'zed', 'age': 19},
]
+You can also do more complicated things like::
+ {{ for book in books|dictsort:"author.age"
+ * {{ book.title }} ({{ book.author.name }})
+ {% endfor %}
+
+If ``books`` is:
+
+.. code-block:: python
+
+ [
+ {'title': '1984', 'author': {'name': 'George', 'age': 45}},
+ {'title': 'Timequake', 'author': {'name': 'Kurt', 'age': 75}},
+ {'title': 'Alice', 'author': {'name': 'Lewis', 'age': 33}},
+ ]
+
+the the output would be::
+
+ * Alice (Lewis)
+ * 1984 (George)
+ * Timequake (Kurt)
+
.. templatefilter:: dictsortreversed
dictsortreversed