#13052: reverse() does not resolve correctly using namespaces in some cases
---------------------------+------------------------------------------------
Reporter: [email protected] | Owner: nobody
Status: new | Milestone: 1.2
Component: Uncategorized | Version: SVN
Keywords: | Stage: Unreviewed
Has_patch: 0 |
---------------------------+------------------------------------------------
When reversing a set of included urls with a url prefix which contains a
parameter, the resolver will treat the url chunk before the include as a
prefix and not process it.
{{{
from django.conf.urls.defaults import *
app1 = (patterns('',
url(r'^edit/(?P<object_id>\d+)/$', 'view', name='view'),
url(r'^list/$', 'view', name='list'),
), 'myapp', 'theinstance1')
app2 = (patterns('',
url(r'^edit/(?P<object_id>\d+)/$', 'view', name='view'),
url(r'^list/$', 'view', name='list'),
), 'myapp', 'theinstance2')
urlpatterns = patterns('views',
url(r'^site/$', 'view', name='view'),
url(r'^site/(?P<site_id>\d+)/pages/', include(app1)),
url(r'^site/', include(app2)),
)
>>> from django.core.urlresolvers import reverse
>>> reverse('view')
'/site/'
>>> reverse('view', current_app='theinstance1')
'/site/'
>>> reverse('myapp:view', current_app='theinstance1')
'/site/(?P%3Csite_id%3E%5Cd+)/pages/list/'
>>> reverse('myapp:list', current_app='theinstance1')
'/site/(?P%3Csite_id%3E%5Cd+)/pages/list/'
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/13052>
Django <http://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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en.