#21927: URL namespacing improvements
--------------------------------------+------------------------------------
Reporter: aaugustin | Owner: nobody
Type: Cleanup/optimization | Status: new
Component: Core (URLs) | Version: master
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
--------------------------------------+------------------------------------
Comment (by mrmachine):
@bendavis78, I agree that "keeping an app's URLs from conflicting with
each other" alone is not reason enough for significant change. But it is a
nice side effect, and not one that should deter us from making significant
change.
On `current_app`, Django could set a default hint for it in request
middleware (or before middleware runs) in thread local storage. Then
Django could use that hint (again, as a default only) any time `reverse()`
or `{% url %}` is called.
There is a problem with forcing ALL included app URLs into a namespace. It
makes it impossible for project developers to override the location of a
particular URL provided by a particular app. For example, generic app
`foo` is installed at `/foo/`. It provides a URL named `bar` at
`/foo/bar/`. If a project developer wants to shorten just that URL to
`/bar/`, he can't if it has been installed in a namespace.
If this problem could be worked around, e.g. by allowing a namespace to be
given to a single URL included in the root URLconf (not only when one
URLconf is included into another), and have that URL be detected first and
therefore overriding the version from the included URLconf, then I would
wholeheartedly support your proposal of giving ALL included URLs a default
namespace that matches their app label.
--
Ticket URL: <https://code.djangoproject.com/ticket/21927#comment:9>
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/067.3812492453d4e0cea384859693559315%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.