﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
21927	URL namespacing improvements	Aymeric Augustin	Marten Kenbeek	"I discussed URL namespacing with Malcolm at DjangoCon US 2012. I took some notes on the current design and possible improvements.

Unfortunately, I haven't found the time and motivation to actually work on these improvements since then. I just mentioned them in #20734.

I'm including below a slightly edited version of my notes. Not everything is clear, but that's all I have, and I don't remember anything else.

----

'''Use cases'''

URL namespaces only exist for the purpose of reversing. They're ""names for groups of URLs"".
(They're analogous to XML namespaces in this regard.)

- Apps need to be able to reverse their own URLs, even if there are several instances installed.
- It must be possible to find the default instance of an app.
- It must be possible to find a specific instance of an app.

'''Application vs. instance namespaces'''

An application namespace = app_name

- There can be only one in a given project.
- The only use case for not using the application label is name conflicts.
- Shouldn't it be eventually moved to app._meta? ''(not sure about what I meant there)''

An instance namespace = namespace

- It differentiate instances of the same application.


'''Next steps'''

1) Clarify documentation

2) Make it possible to reverse without specifying the namespace and document this pattern:
{{{
urlpatterns = (
    url(r'^foo/', include('foo.urls', namespace='foo')),
)
}}}
This requires a way to specifiy the default namespace.  It would supersede #11642."	Cleanup/optimization	closed	Core (URLs)	dev	Normal	fixed		real.human@… Ben Davis dries@… Florian Apolloner info+coding@… marten.knbk@…	Accepted	1	0	0	0	0	0
