#27367: Document behaviour when several urls have the same name
-------------------------------------+--------------------
     Reporter:  Christoph Schindler  |      Owner:  nobody
         Type:  Uncategorized        |     Status:  new
    Component:  Documentation        |    Version:  1.10
     Severity:  Normal               |   Keywords:
 Triage Stage:  Unreviewed           |  Has patch:  0
Easy pickings:  0                    |      UI/UX:  0
-------------------------------------+--------------------
 Currently -- as far as i can tell -- it is no problem to give the same
 name to different urls and then reverse them:

 {{{
     url(r'^spam/$', 'myapp.views.index', name='myview'),
     url(r'^spam/(?P<ham>[\w-]+)/$', 'myapp.views.detail', name='myview'),
     url(r'^spam/(?P<ham>[\w-]+)/(?P<eggs>[\w-]+)/$', 'myapp.views.detail',
 name='myview'),
 }}}

 {{{
 In [8]: reverse('myview', kwargs={'ham': 'foo', 'eggs': 'bar'})
 Out[8]: u'/spam/foo/bar/'

 In [9]: reverse('myview', kwargs={'ham': 'foo'})
 Out[9]: u'/spam/foo/'

 In [10]: reverse('myview')
 Out[10]: u'/spam/'
 }}}

 But this is not documented and it is not clear, whether this is supported
 or unsupported behaviour.

 It should either be stated clearly that url names should be unique /or/
 that it is possible to "overload" url patterns by giving them the same
 name when they have a different number of arguments.

--
Ticket URL: <https://code.djangoproject.com/ticket/27367>
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/046.71fe18991e8610a11a73ca9cc0ea667c%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to