diff options
| author | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-12-14 17:48:51 +0100 |
|---|---|---|
| committer | Aymeric Augustin <aymeric.augustin@m4x.org> | 2014-12-28 17:02:29 +0100 |
| commit | cf1f36bb6eb34fafe6c224003ad585a647f6117b (patch) | |
| tree | 7e3714ca48a6456ba5d3ebed2fc873f9ff0e6dc6 /docs/topics/http | |
| parent | e53495ba3352c2c0fdb6178f2b333c30cb6b5d46 (diff) | |
Deprecated current_app in TemplateResponse and render(_to_response).
Diffstat (limited to 'docs/topics/http')
| -rw-r--r-- | docs/topics/http/shortcuts.txt | 5 | ||||
| -rw-r--r-- | docs/topics/http/urls.txt | 18 |
2 files changed, 17 insertions, 6 deletions
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 |
