#24127: Automatically set the current URL namespace based on the URL of the current request -------------------------------------+------------------------------------- Reporter: aaugustin | Owner: nobody Type: New | Status: new feature | Component: Core | Version: master (URLs) | Keywords: multiple-template- Severity: Normal | engines Triage Stage: | Has patch: 0 Unreviewed | Needs documentation: 0 | Needs tests: 0 Patch needs improvement: 0 | Easy pickings: 0 UI/UX: 0 | -------------------------------------+------------------------------------- The [https://docs.djangoproject.com/en/dev/topics/http/urls/#reversing- namespaced-urls documentation on URL namespaces] shows the following example:
{{{ 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. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To post to this group, send email to django-updates@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/052.2b1062f09cbec06a2709d49b97b84c96%40djangoproject.com. For more options, visit https://groups.google.com/d/optout.