Kaydet (Commit) 0b074160 authored tarafından Zbigniew Siciarz's avatar Zbigniew Siciarz Kaydeden (comit) Florian Apolloner

Fixed #20294 -- Documented context processors in TemplateResponseMixin.

üst 8fd44b25
...@@ -60,6 +60,17 @@ TemplateResponseMixin ...@@ -60,6 +60,17 @@ 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
``TemplateResponse`` uses :class:`~django.template.RequestContext`
which means that callables defined in
:setting:`TEMPLATE_CONTEXT_PROCESSORS` may overwrite template
variables defined in your views. For example, if you subclass
:class:`DetailView <django.views.generic.detail.DetailView>` and
set ``context_object_name`` to ``user``, the
``django.contrib.auth.context_processors.auth`` context processor
will happily overwrite your variable with current user.
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
``response_class``. ``response_class``.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment