#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):
One weird thing about the examples above (which I completely agree with),
why is the app name AND a `current_app` hint required for `reverse` but
not for `{% url %}`? E.g. `reverse('usefulapp:another_thing',
current_app=current_app)` vs `{% url "another_thing" %}` (with the
`current_app` hint set on the context)?
I really think that the current state of namespacing is broken. Yes, it
was intended to allow multiple deployments of the same app, but there is
an obvious and legitimate desire for app authors to name their URLs
uniquely *within their app*, and allow project authors to specify a
namespace to avoid conflicts between apps that know nothing about each
other.
Currently, this requires explicit additional repetitive work by app
authors during development *and* explicit installation instructions to
project authors.
Django knows which URL matches the request path. It knows the namespace
that a project author might have optionally specified for that URLconf.
Django should use that automatically when using `reverse()` and `{% url
%}`. App authors can then write their apps without any worry about
additional code or explicit installation instructions. They can name their
URLs without worrying about conflicts with other apps, as long as they are
unique within *their* app. Then project authors can install any app with
any namespace they like.
--
Ticket URL: <https://code.djangoproject.com/ticket/21927#comment:6>
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.5f1b9643d6e5f27079304f093fc0f780%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.