Ticket #4817: 4817.patch
File 4817.patch, 1.3 KB (added by , 17 years ago) |
---|
-
docs/url_dispatch.txt
200 200 optional extra arguments dictionary. For example:: 201 201 202 202 urlpatterns = patterns('', 203 url(r' /index/$', index_view, name="main-view"),203 url(r'index/$', index_view, name="main-view"), 204 204 ... 205 205 ) 206 206 … … 506 506 view:: 507 507 508 508 urlpatterns = patterns('', 509 (r' /archive/(\d{4})/$', archive),510 (r' /archive-summary/(\d{4})/$', archive, {'summary': True}),509 (r'archive/(\d{4})/$', archive), 510 (r'archive-summary/(\d{4})/$', archive, {'summary': True}), 511 511 ) 512 512 513 513 This is completely valid, but it leads to problems when you try to do reverse … … 524 524 Here's the above example, rewritten to used named URL patterns:: 525 525 526 526 urlpatterns = patterns('', 527 url(r' /archive/(\d{4})/$', archive, name="full-archive"),528 url(r' /archive-summary/(\d{4})/$', archive, {'summary': True}, "arch-summary"),527 url(r'archive/(\d{4})/$', archive, name="full-archive"), 528 url(r'archive-summary/(\d{4})/$', archive, {'summary': True}, "arch-summary"), 529 529 ) 530 530 531 531 With these names in place (``full-archive`` and ``arch-summary``), you can