1
0
mirror of https://github.com/django/django.git synced 2024-12-23 01:25:58 +00:00

Fixed #9472 -- Fixed a couple of URL patterns to be more consistent (and remove

a misleading initial slash). Thanks, daveyjoe.


git-svn-id: http://code.djangoproject.com/svn/django/trunk@9471 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Malcolm Tredinnick 2008-11-16 09:35:30 +00:00
parent 3e267a695e
commit a573f4c029

View File

@ -227,7 +227,7 @@ You can use the ``url()`` function, instead of a tuple, as an argument to
optional extra arguments dictionary. For example::
urlpatterns = patterns('',
url(r'/index/$', index_view, name="main-view"),
url(r'^index/$', index_view, name="main-view"),
...
)
@ -539,8 +539,8 @@ your URLconf. For example, these two URL patterns both point to the ``archive``
view::
urlpatterns = patterns('',
(r'/archive/(\d{4})/$', archive),
(r'/archive-summary/(\d{4})/$', archive, {'summary': True}),
(r'^archive/(\d{4})/$', archive),
(r'^archive-summary/(\d{4})/$', archive, {'summary': True}),
)
This is completely valid, but it leads to problems when you try to do reverse
@ -557,8 +557,8 @@ matching.
Here's the above example, rewritten to use named URL patterns::
urlpatterns = patterns('',
url(r'/archive/(\d{4})/$', archive, name="full-archive"),
url(r'/archive-summary/(\d{4})/$', archive, {'summary': True}, "arch-summary"),
url(r'^archive/(\d{4})/$', archive, name="full-archive"),
url(r'^archive-summary/(\d{4})/$', archive, {'summary': True}, "arch-summary"),
)
With these names in place (``full-archive`` and ``arch-summary``), you can