summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAymeric Augustin <aymeric.augustin@m4x.org>2014-12-14 17:48:51 +0100
committerAymeric Augustin <aymeric.augustin@m4x.org>2014-12-28 17:02:29 +0100
commitcf1f36bb6eb34fafe6c224003ad585a647f6117b (patch)
tree7e3714ca48a6456ba5d3ebed2fc873f9ff0e6dc6 /docs
parente53495ba3352c2c0fdb6178f2b333c30cb6b5d46 (diff)
Deprecated current_app in TemplateResponse and render(_to_response).
Diffstat (limited to 'docs')
-rw-r--r--docs/internals/deprecation.txt8
-rw-r--r--docs/ref/contrib/admin/index.txt15
-rw-r--r--docs/ref/template-response.txt5
-rw-r--r--docs/releases/1.8.txt15
-rw-r--r--docs/topics/http/shortcuts.txt5
-rw-r--r--docs/topics/http/urls.txt18
6 files changed, 55 insertions, 11 deletions
diff --git a/docs/internals/deprecation.txt b/docs/internals/deprecation.txt
index 0adf08ed5e..bf659d8c62 100644
--- a/docs/internals/deprecation.txt
+++ b/docs/internals/deprecation.txt
@@ -90,6 +90,14 @@ details on these changes.
* The backwards compatibility alias ``django.template.loader.BaseLoader`` will
be removed.
+* The ``current_app`` parameter for the following function and classes will be
+ removed:
+
+ * ``django.shortcuts.render()``
+ * ``django.template.Context()``
+ * ``django.template.RequestContext()``
+ * ``django.template.response.TemplateResponse()``
+
* The ``dictionary`` and ``context_instance`` parameters for the following
functions will be removed:
diff --git a/docs/ref/contrib/admin/index.txt b/docs/ref/contrib/admin/index.txt
index a1d4c3a563..a6a315cc88 100644
--- a/docs/ref/contrib/admin/index.txt
+++ b/docs/ref/contrib/admin/index.txt
@@ -2628,11 +2628,16 @@ a pattern for your new view.
.. note::
Any view you render that uses the admin templates, or extends the base
- admin template, should provide the ``current_app`` argument to
- :class:`~django.template.RequestContext` or
- :class:`~django.template.Context` when rendering the template. It should
- be set to either ``self.name`` if your view is on an ``AdminSite`` or
- ``self.admin_site.name`` if your view is on a ``ModelAdmin``.
+ admin template, should set ``request.current_app`` before rendering the
+ template. It should be set to either ``self.name`` if your view is on an
+ ``AdminSite`` or ``self.admin_site.name`` if your view is on a
+ ``ModelAdmin``.
+
+ .. versionchanged:: 1.8
+
+ In previous versions of Django, you had to provide the ``current_app``
+ argument to :class:`~django.template.RequestContext` or
+ :class:`~django.template.Context` when rendering the template.
.. _auth_password_reset:
diff --git a/docs/ref/template-response.txt b/docs/ref/template-response.txt
index bfee0e29af..3f7572b557 100644
--- a/docs/ref/template-response.txt
+++ b/docs/ref/template-response.txt
@@ -182,6 +182,11 @@ Methods
:ref:`namespaced URL resolution strategy <topics-http-reversing-url-namespaces>`
for more information.
+ .. deprecated:: 1.8
+
+ The ``current_app`` argument is deprecated. Instead you should set
+ ``request.current_app``.
+
``charset``
The charset in which the response will be encoded. If not given it will
be extracted from ``content_type``, and if that is unsuccessful, the
diff --git a/docs/releases/1.8.txt b/docs/releases/1.8.txt
index 8f871cb96c..39fc642690 100644
--- a/docs/releases/1.8.txt
+++ b/docs/releases/1.8.txt
@@ -1204,6 +1204,21 @@ to construct the "view on site" URL. This URL is now accessible using the
sure to provide a default value for the ``form_class`` argument since it's
now optional.
+``current_app`` argument of template-related APIs
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The following functions and classes will no longer accept a ``current_app``
+parameter to set an URL namespace in Django 2.0:
+
+* ``django.shortcuts.render()``
+* ``django.template.Context()``
+* ``django.template.RequestContext()``
+* ``django.template.response.TemplateResponse()``
+
+Set ``request.current_app`` instead, where ``request`` is the first argument
+to these functions or classes. If you're using a plain ``Context``, use a
+``RequestContext`` instead.
+
``dictionary`` and ``context_instance`` arguments of rendering functions
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
diff --git a/docs/topics/http/shortcuts.txt b/docs/topics/http/shortcuts.txt
index 5c356c2b3b..d3971fb711 100644
--- a/docs/topics/http/shortcuts.txt
+++ b/docs/topics/http/shortcuts.txt
@@ -72,6 +72,11 @@ Optional arguments
:ref:`namespaced URL resolution strategy <topics-http-reversing-url-namespaces>`
for more information.
+ .. deprecated:: 1.8
+
+ The ``current_app`` argument is deprecated. Instead you should set
+ ``request.current_app``.
+
.. versionchanged:: 1.7
The ``dirs`` parameter was added.
diff --git a/docs/topics/http/urls.txt b/docs/topics/http/urls.txt
index a63eff075d..a7dbb72462 100644
--- a/docs/topics/http/urls.txt
+++ b/docs/topics/http/urls.txt
@@ -633,10 +633,16 @@ the fully qualified name into parts and then tries the following lookup:
2. If there is a *current* application defined, Django finds and returns
the URL resolver for that instance. The *current* application can be
- specified as an attribute on the template context - applications that
- expect to have multiple deployments should set the ``current_app``
- attribute on any :class:`~django.template.Context` or
- :class:`~django.template.RequestContext` that is used to render a template.
+ specified as an attribute on the request. Applications that expect to
+ have multiple deployments should set the ``current_app`` attribute on
+ the ``request`` being processed.
+
+ .. versionchanged:: 1.8
+
+ In previous versions of Django, you had to set the ``current_app``
+ attribute on any :class:`~django.template.Context` or
+ :class:`~django.template.RequestContext` that is used to render a
+ template.
The current application can also be specified manually as an argument
to the :func:`~django.core.urlresolvers.reverse` function.
@@ -707,10 +713,10 @@ Using this setup, the following lookups are possible:
{% url 'polls:index' %}
Note that reversing in the template requires the ``current_app`` be added as
- an attribute to the template context like this::
+ an attribute to the ``request`` like this::
def render_to_response(self, context, **response_kwargs):
- response_kwargs['current_app'] = self.request.resolver_match.namespace
+ self.request.current_app = self.request.resolver_match.namespace
return super(DetailView, self).render_to_response(context, **response_kwargs)
* If there is no current instance - say, if we were rendering a page