Updated TemplateResponseMixin docs to reflect new behavior after refs #23789.
This commit is contained in:
parent
108b8bf852
commit
493ab45349
|
@ -58,16 +58,19 @@ TemplateResponseMixin
|
||||||
altered later (e.g. in
|
altered later (e.g. in
|
||||||
:ref:`template response middleware <template-response-middleware>`).
|
:ref:`template response middleware <template-response-middleware>`).
|
||||||
|
|
||||||
.. admonition:: Context processors
|
.. versionchanged:: 1.8
|
||||||
|
|
||||||
``TemplateResponse`` uses :class:`~django.template.RequestContext`
|
In older versions of Django, ``TemplateResponse`` used
|
||||||
which means that callables defined in
|
:class:`~django.template.RequestContext` in such a way that
|
||||||
:setting:`TEMPLATE_CONTEXT_PROCESSORS` may overwrite template
|
callables defined in :setting:`TEMPLATE_CONTEXT_PROCESSORS` would
|
||||||
variables defined in your views. For example, if you subclass
|
override template variables defined in your views. For example, if
|
||||||
:class:`DetailView <django.views.generic.detail.DetailView>` and
|
you subclassed :class:`DetailView
|
||||||
|
<django.views.generic.detail.DetailView>` and
|
||||||
set ``context_object_name`` to ``user``, the
|
set ``context_object_name`` to ``user``, the
|
||||||
``django.contrib.auth.context_processors.auth`` context processor
|
``django.contrib.auth.context_processors.auth`` context processor
|
||||||
will happily overwrite your variable with current user.
|
would overwrite your variable with the current user. Now, for
|
||||||
|
consistency with the ``render()`` shortcut, values in the context
|
||||||
|
provided by the class override values from context processors.
|
||||||
|
|
||||||
If you need custom template loading or custom context object
|
If you need custom template loading or custom context object
|
||||||
instantiation, create a ``TemplateResponse`` subclass and assign it to
|
instantiation, create a ``TemplateResponse`` subclass and assign it to
|
||||||
|
|
Loading…
Reference in New Issue