mirror of
https://github.com/django/django.git
synced 2025-08-13 15:28:49 +00:00
[1.9.x] Fixed #25804 -- Documented additions to Jinja2 context.
Backport of 6aef986cdb
from master
This commit is contained in:
parent
7b2ee75745
commit
27bed94e9c
1 changed files with 7 additions and 4 deletions
|
@ -456,10 +456,13 @@ adds defaults that differ from Jinja2's for a few options:
|
||||||
* ``'auto_reload'``: ``settings.DEBUG``
|
* ``'auto_reload'``: ``settings.DEBUG``
|
||||||
* ``'undefined'``: ``DebugUndefined if settings.DEBUG else Undefined``
|
* ``'undefined'``: ``DebugUndefined if settings.DEBUG else Undefined``
|
||||||
|
|
||||||
The default configuration is purposefully kept to a minimum. The ``Jinja2``
|
The default configuration is purposefully kept to a minimum. If a template is
|
||||||
backend doesn't create a Django-flavored environment. It doesn't know about
|
rendered with a request (e.g. when using :py:func:`~django.shortcuts.render`),
|
||||||
Django context processors, filters, and tags. In order to use Django-specific
|
the ``Jinja2`` backend adds the globals ``request``, ``csrf_input``, and
|
||||||
APIs, you must configure them into the environment.
|
``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::
|
For example, you can create ``myproject/jinja2.py`` with this content::
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue