mirror of
https://github.com/django/django.git
synced 2025-08-04 10:59:45 +00:00
Fixed #17229 -- Allow 'True', 'False' and 'None' to resolve to the corresponding Python objects in templates.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@17894 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
28e5b66518
commit
93240b7d90
5 changed files with 30 additions and 12 deletions
|
@ -111,6 +111,9 @@ template::
|
|||
>>> t.render(c)
|
||||
"My name is Dolores."
|
||||
|
||||
Variables and lookups
|
||||
~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
Variable names must consist of any letter (A-Z), any digit (0-9), an underscore
|
||||
(but they must not start with an underscore) or a dot.
|
||||
|
||||
|
@ -225,7 +228,6 @@ straight lookups. Here are some things to keep in mind:
|
|||
if your variable is not callable (allowing you to access attributes of
|
||||
the callable, for example).
|
||||
|
||||
|
||||
.. _invalid-template-variables:
|
||||
|
||||
How invalid variables are handled
|
||||
|
@ -263,6 +265,16 @@ be replaced with the name of the invalid variable.
|
|||
in order to debug a specific template problem, then cleared
|
||||
once debugging is complete.
|
||||
|
||||
Builtin variables
|
||||
~~~~~~~~~~~~~~~~~
|
||||
|
||||
Every context contains ``True``, ``False`` and ``None``. As you would expect,
|
||||
these variables resolve to the corresponding Python objects.
|
||||
|
||||
.. versionadded:: 1.5
|
||||
Before Django 1.5, these variables weren't a special case, and they
|
||||
resolved to ``None`` unless you defined them in the context.
|
||||
|
||||
Playing with Context objects
|
||||
----------------------------
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue