summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoritz Sichert <moritz.sichert@googlemail.com>2016-03-13 13:31:11 +0100
committerTim Graham <timograham@gmail.com>2016-03-14 08:43:35 -0400
commit27bed94e9cb4eb712ddda465e6bbd3aca5f15ce4 (patch)
treee5660860176292e0dc0e0295939ca18611b48f7a
parent7b2ee75745a5304b222b71b3273ff14a40da47f4 (diff)
[1.9.x] Fixed #25804 -- Documented additions to Jinja2 context.
Backport of 6aef986cdbff72809b39880132959ef74827492f from master
-rw-r--r--docs/topics/templates.txt11
1 files changed, 7 insertions, 4 deletions
diff --git a/docs/topics/templates.txt b/docs/topics/templates.txt
index 5e5dee5168..77c3b4ce4c 100644
--- a/docs/topics/templates.txt
+++ b/docs/topics/templates.txt
@@ -456,10 +456,13 @@ adds defaults that differ from Jinja2's for a few options:
* ``'auto_reload'``: ``settings.DEBUG``
* ``'undefined'``: ``DebugUndefined if settings.DEBUG else Undefined``
-The default configuration is purposefully kept to a minimum. The ``Jinja2``
-backend doesn't create a Django-flavored environment. It doesn't know about
-Django context processors, filters, and tags. In order to use Django-specific
-APIs, you must configure them into the environment.
+The default configuration is purposefully kept to a minimum. If a template is
+rendered with a request (e.g. when using :py:func:`~django.shortcuts.render`),
+the ``Jinja2`` backend adds the globals ``request``, ``csrf_input``, and
+``csrf_token`` to the context. Apart from that, this backend doesn't create a
+Django-flavored environment. It doesn't know about Django context processors,
+filters, and tags. In order to use Django-specific APIs, you must configure
+them into the environment.
For example, you can create ``myproject/jinja2.py`` with this content::