#11559: urlresolvers.reverse do not work with namespaced urls and captured parameters in parent urlconf -------------------------------+-------------------------------------------- Reporter: kmik...@gmail.com | Owner: nobody Status: new | Milestone: Component: Core framework | Version: SVN Keywords: | Stage: Unreviewed Has_patch: 0 | -------------------------------+-------------------------------------------- Urlresolvers.reverse (and {% url .. %} template tag) do not work with namespaced urls and captured parameters in parent urlconf.
This works: {{{ # In urls.py urlpatterns = patterns('', (r'^(?P<username>\w+)/blog/', include('foo.urls')), ) # In foo/urls.py urlpatterns = patterns('foo.views', url(r'^index$', 'blog.index', name='blog_index'), url(r'^archive/$', 'blog.archive', name='blog_archive'), ) #in some view from django.core.urlresolvers import reverse url = reverse('blog_index', args=['john']) }}} And this doesn't: {{{ # In urls.py urlpatterns = patterns('', (r'^(?P<username>\w+)/blog/', include('foo.urls', namespace='user_blogs', app_name='foo')), ) # In foo/urls.py urlpatterns = patterns('foo.views', url(r'^index$', 'blog.index', name='blog_index'), url(r'^archive/$', 'blog.archive', name='blog_archive'), ) #in some view from django.core.urlresolvers import reverse url = reverse('user_blogs:blog_index', args=['john'], current_app='foo') }}} This works again: {{{ # In urls.py urlpatterns = patterns('', (r'^(?P<username>\w+)/blog/', include('foo.urls', namespace='user_blogs', app_name='foo')), ) # In foo/urls.py urlpatterns = patterns('foo.views', url(r'^index$', 'blog.index', name='blog_index'), url(r'^archive/$', 'blog.archive', name='blog_archive'), ) #in some view from django.core.urlresolvers import reverse url = reverse('user_blogs:blog_index', current_app='foo') # but `url` variable contains "/(?P<username>\\w+)/blog/index" }}} -- Ticket URL: <http://code.djangoproject.com/ticket/11559> 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 django-updates@googlegroups.com To unsubscribe from this group, send email to django-updates+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-updates?hl=en -~----------~----~----~----~------~----~------~--~---