mirror of
https://github.com/django/django.git
synced 2025-08-04 19:08:28 +00:00
Removed dictionary and context_instance parameters for render functions.
Per deprecation timeline.
This commit is contained in:
parent
b3641512c8
commit
9023696613
11 changed files with 29 additions and 256 deletions
|
@ -15,14 +15,13 @@ introduce controlled coupling for convenience's sake.
|
|||
``render``
|
||||
==========
|
||||
|
||||
.. function:: render(request, template_name, context=None, context_instance=_context_instance_undefined, content_type=None, status=None, using=None)
|
||||
.. function:: render(request, template_name, context=None, content_type=None, status=None, using=None)
|
||||
|
||||
Combines a given template with a given context dictionary and returns an
|
||||
:class:`~django.http.HttpResponse` object with that rendered text.
|
||||
|
||||
:func:`render()` is the same as a call to
|
||||
:func:`render_to_response()` with a ``context_instance`` argument that
|
||||
forces the use of a :class:`~django.template.RequestContext`.
|
||||
:func:`render()` is the same as a call to :func:`render_to_response()` but
|
||||
it also makes the current request available in the template.
|
||||
|
||||
Django does not provide a shortcut function which returns a
|
||||
:class:`~django.template.response.TemplateResponse` because the constructor
|
||||
|
@ -46,20 +45,6 @@ Optional arguments
|
|||
is an empty dictionary. If a value in the dictionary is callable, the
|
||||
view will call it just before rendering the template.
|
||||
|
||||
.. versionchanged:: 1.8
|
||||
|
||||
The ``context`` argument used to be called ``dictionary``. That name
|
||||
is deprecated in Django 1.8 and will be removed in Django 1.10.
|
||||
|
||||
``context_instance``
|
||||
The context instance to render the template with. By default, the template
|
||||
will be rendered with a ``RequestContext`` instance (filled with values from
|
||||
``request`` and ``context``).
|
||||
|
||||
.. deprecated:: 1.8
|
||||
|
||||
The ``context_instance`` argument is deprecated. Simply use ``context``.
|
||||
|
||||
``content_type``
|
||||
The MIME type to use for the resulting document. Defaults to the value of
|
||||
the :setting:`DEFAULT_CONTENT_TYPE` setting.
|
||||
|
@ -103,7 +88,7 @@ This example is equivalent to::
|
|||
``render_to_response``
|
||||
======================
|
||||
|
||||
.. function:: render_to_response(template_name, context=None, context_instance=_context_instance_undefined, content_type=None, status=None, using=None)
|
||||
.. function:: render_to_response(template_name, context=None, content_type=None, status=None, using=None)
|
||||
|
||||
Renders a given template with a given context dictionary and returns an
|
||||
:class:`~django.http.HttpResponse` object with that rendered text.
|
||||
|
@ -125,27 +110,6 @@ Optional arguments
|
|||
is an empty dictionary. If a value in the dictionary is callable, the
|
||||
view will call it just before rendering the template.
|
||||
|
||||
.. versionchanged:: 1.8
|
||||
|
||||
The ``context`` argument used to be called ``dictionary``. That name
|
||||
is deprecated in Django 1.8 and will be removed in Django 1.10.
|
||||
|
||||
``context_instance``
|
||||
The context instance to render the template with. By default, the template
|
||||
will be rendered with a :class:`~django.template.Context` instance (filled
|
||||
with values from ``context``). If you need to use :ref:`context
|
||||
processors <subclassing-context-requestcontext>`, render the template with
|
||||
a :class:`~django.template.RequestContext` instance instead. Your code
|
||||
might look something like this::
|
||||
|
||||
return render_to_response('my_template.html',
|
||||
my_context,
|
||||
context_instance=RequestContext(request))
|
||||
|
||||
.. deprecated:: 1.8
|
||||
|
||||
The ``context_instance`` argument is deprecated. Simply use ``context``.
|
||||
|
||||
``content_type``
|
||||
The MIME type to use for the resulting document. Defaults to the value of
|
||||
the :setting:`DEFAULT_CONTENT_TYPE` setting.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue