diff options
| author | Jacek Bzdak <jbzdak@gmail.com> | 2015-10-20 19:12:48 +0200 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2015-10-21 11:46:06 -0400 |
| commit | 3e8234b77e2698d14a7825319845e5038424f09d (patch) | |
| tree | 8d351f8168959c8a512a6fa21f428c5812f445f4 /docs/ref | |
| parent | cf1038d8e39df914bace26d78f321556036a51c6 (diff) | |
[1.8.x] Fixed #25574 -- Documented {{ dict.items }} shadowing in for template tag docs.
Backport of 32cd7069711d2e02fcd20c005c59c175d542c62e from master
Diffstat (limited to 'docs/ref')
| -rw-r--r-- | docs/ref/templates/builtins.txt | 8 | ||||
| -rw-r--r-- | docs/ref/templates/language.txt | 2 |
2 files changed, 10 insertions, 0 deletions
diff --git a/docs/ref/templates/builtins.txt b/docs/ref/templates/builtins.txt index f12ffb0c65..e15896f05e 100644 --- a/docs/ref/templates/builtins.txt +++ b/docs/ref/templates/builtins.txt @@ -320,6 +320,14 @@ would display the keys and values of the dictionary:: {{ key }}: {{ value }} {% endfor %} +Keep in mind that for the dot operator, dictionary key lookup takes precedence +over method lookup. Therefore if the ``data`` dictionary contains a key named +``'items'``, ``data.items`` will return ``data['items']`` instead of +``data.items()``. Avoid adding keys that are named like dictionary methods if +you want to use those methods in a template (``items``, ``values``, ``keys``, +etc.). Read more about the lookup order of the dot operator in the +:ref:`documentation of template variables <template-variables>`. + The for loop sets a number of variables available within the loop: ========================== =============================================== diff --git a/docs/ref/templates/language.txt b/docs/ref/templates/language.txt index 4691a07689..0a50adfa19 100644 --- a/docs/ref/templates/language.txt +++ b/docs/ref/templates/language.txt @@ -74,6 +74,8 @@ explained later in this document. Oh, and one more thing: making humans edit XML is sadistic! +.. _template-variables: + Variables ========= |
