﻿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
11642	Specify default namespace in urls.py	Tai Lee	Amirouche	"The new URL namespace feature is great, but could be made a little easier to use by allowing a default namespace to be defined as a variable in the urls module being included (e.g. `namespace`). This could be looked up by Django automatically if no namespace is specified when the urls module is included, in the same way that `urlpatterns` is looked up.

In `myapp/urls.py`:

{{{
namespace = 'myapp'

urlpatterns('myapp',
    url('^$', 'index', name='index'),
)
}}}

In `myproject/urls.py`:

{{{
urlpatterns('',
    url(r'^myapp/$', include('myapp.urls')),
)
}}}

In your templates:

{{{
{% url myapp:index %}
}}}

The benefit here is that users will not need to specify a namespace for every app in their urls module to avoid clashes with commonly named urls (e.g. ""index""), unless they are deploying multiple instances of the same app, which I would have thought is the less common case.

At the moment I believe the only way to specify a default namespace (like the `admin` app does) is to define a three item tuple somewhere in `myapp` which contains `urlpatterns` from `myapp.urls` plus app and instance namespaces. But this can't be referenced by a simple string like the urls module can, it must be imported directly before being used. It also seems a little messy and counter-intuitive asking users to import and include `myapp.urls.namespace` or `myapp.urls_namespace` or something similar, instead of just importing or referencing the urls module.
"	New feature	closed	Core (URLs)	1.1	Normal	fixed	url namespace default	amirouche.boubekki@… Florian Apolloner	Accepted	0	1	1	1	0	0
