{{{
def render_to_response(self, context, **response_kwargs):
self.request.current_app = self.request.resolver_match.namespace
return super(DetailView, self).render_to_response(context,
**response_kwargs)
}}}
`self.request.current_app = self.request.resolver_match.namespace` looks
like something that makes sense in general and could be done automatically
for all requests.
This became possible in Django 1.8 because `current_app` is now an
attribute of the `request` object.
There are some fairly obvious backwards-compatibility concerns, but this
change looks like it could save a lot of boilerplate code.
--
Ticket URL: <https://code.djangoproject.com/ticket/24127>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* stage: Unreviewed => Accepted
Comment:
I felt awkward when I added that documentation.
--
Ticket URL: <https://code.djangoproject.com/ticket/24127#comment:1>
* keywords: multiple-template-engines =>
--
Ticket URL: <https://code.djangoproject.com/ticket/24127#comment:2>
* keywords: => current_app
--
Ticket URL: <https://code.djangoproject.com/ticket/24127#comment:3>
* cc: marten.knbk@… (added)
* owner: nobody => knbk
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/24127#comment:4>
Comment (by timgraham):
Marten, do you plan to move forward with this ticket? It should ease the
deprecation in #24126 a bit as I noted there, I think.
--
Ticket URL: <https://code.djangoproject.com/ticket/24127#comment:5>
Comment (by knbk):
Yes, working on it: https://github.com/django/django/pull/4919
--
Ticket URL: <https://code.djangoproject.com/ticket/24127#comment:6>
Comment (by Marten Kenbeek <marten.knbk@…>):
In [changeset:"6364df68879efc0d9451d6427e34b4542e3d7e0b" 6364df6]:
{{{
#!CommitTicketReference repository=""
revision="6364df68879efc0d9451d6427e34b4542e3d7e0b"
Refs #24127 -- Added documentation for HttpRequest.current_app.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24127#comment:7>
Comment (by Tim Graham <timograham@…>):
In [changeset:"ae93aeed2b87c4a6dd9290146aaee5dc57d07bfb" ae93aee]:
{{{
#!CommitTicketReference repository=""
revision="ae93aeed2b87c4a6dd9290146aaee5dc57d07bfb"
[1.8.x] Refs #24127 -- Added documentation for HttpRequest.current_app.
Backport of 6364df68879efc0d9451d6427e34b4542e3d7e0b from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24127#comment:8>
* has_patch: 0 => 1
* needs_tests: 0 => 1
--
Ticket URL: <https://code.djangoproject.com/ticket/24127#comment:9>
* needs_tests: 1 => 0
--
Ticket URL: <https://code.djangoproject.com/ticket/24127#comment:10>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"bc7923beffea3c51271935cad1371a67c5fcc71b" bc7923b]:
{{{
#!CommitTicketReference repository=""
revision="bc7923beffea3c51271935cad1371a67c5fcc71b"
Fixed #24127 -- Changed the default current_app to the current namespace.
Changed the url template tag to use request.resolver_match.namespace as a
default for the current_app argument if request.current_app is not set.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/24127#comment:11>