#25574: A minor enhancement to "for" tag description in the reference
-------------------------------------+-------------------------------------
Reporter: wodny | Owner: jbzdak
Type: | Status: assigned
Cleanup/optimization |
Component: Documentation | Version: 1.8
Severity: Normal | Resolution:
Keywords: for tag lookup | Triage Stage: Accepted
order dict defaultdict |
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by jbzdak):
* has_patch: 0 => 1
Comment:
Here is the PR link: https://github.com/django/django/pull/5450.
Here is full wording (maybe a bit verbose):
{{{
Keep in mind that ``items`` key in a dictionary will shadow
``items()``
function. This lookup order can cause some unexpected behavior.
In normal situations Django template expression ``{{ data.items }}``
will
return result of following python code: ``data.items()``, however if
``data`` dictionary will contain ``items`` key, the same django
expression
will return: ``data['items']``, which is most probably *not what you
want*.
You should avoid adding dictionary entries whose keys are named like
methods
of dictionary instance for example: ``items``, ``values``, ``keys``,
to
dictionaries that will be passed to Django templates.
For additional information see
:ref:`documentation of template variables <template-variables>`.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/25574#comment:3>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/063.4020f9fd084fe050ebb06147c65d8e5f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.