summaryrefslogtreecommitdiff
path: root/docs/topics
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-12-14 10:17:18 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2014-12-28 17:02:29 +0100
commitfdbfc98003f0ba2d3a12def63a75560791f3602d (patch)
tree0238fba169970595f1a8c44d53550fada6236b4f /docs/topics
parenta0141f9eac03f0fef722e757253bbc939c018f77 (diff)
Deprecated some arguments of django.shortcuts.render(_to_response).
dictionary and context_instance and superseded by context. Refactored tests that relied context_instance with more modern idioms.
Diffstat (limited to 'docs/topics')
-rw-r--r--docs/topics/http/shortcuts.txt43
1 files changed, 34 insertions, 9 deletions
diff --git a/docs/topics/http/shortcuts.txt b/docs/topics/http/shortcuts.txt
index 7a92b690e9..5c356c2b3b 100644
--- a/docs/topics/http/shortcuts.txt
+++ b/docs/topics/http/shortcuts.txt
@@ -15,7 +15,7 @@ introduce controlled coupling for convenience's sake.
``render``
==========
-.. function:: render(request, template_name[, dictionary][, context_instance][, content_type][, status][, current_app][, dirs])
+.. function:: render(request, template_name[, context][, context_instance][, content_type][, status][, current_app][, dirs])
Combines a given template with a given context dictionary and returns an
:class:`~django.http.HttpResponse` object with that rendered text.
@@ -41,15 +41,24 @@ Required arguments
Optional arguments
------------------
-``dictionary``
+``context``
A dictionary of values to add to the template context. By default, this
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 2.0.
+
``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 ``dictionary``).
+ ``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
@@ -67,7 +76,7 @@ Optional arguments
The ``dirs`` parameter was added.
-.. versionchanged:: 1.8
+.. deprecated:: 1.8
The ``dirs`` parameter was deprecated.
@@ -99,7 +108,7 @@ This example is equivalent to::
``render_to_response``
======================
-.. function:: render_to_response(template_name[, dictionary][, context_instance][, content_type][, dirs])
+.. function:: render_to_response(template_name[, context][, context_instance][, content_type][, status][, dirs])
Renders a given template with a given context dictionary and returns an
:class:`~django.http.HttpResponse` object with that rendered text.
@@ -116,32 +125,48 @@ Required arguments
Optional arguments
------------------
-``dictionary``
+``context``
A dictionary of values to add to the template context. By default, this
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 2.0.
+
``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 ``dictionary``). If you need to use :ref:`context
+ 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_data_dictionary,
+ 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.
+``status``
+ The status code for the response. Defaults to ``200``.
+
+.. versionchanged:: 1.8
+
+ The ``status`` parameter was added.
+
.. versionchanged:: 1.7
The ``dirs`` parameter was added.
-.. versionchanged:: 1.8
+.. deprecated:: 1.8
The ``dirs`` parameter was deprecated.