Skip to content

Commit e7615f1

Browse files
author
mtredinnick
committed
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
1 parent a752da0 commit e7615f1

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/topics/http/urls.txt

+5-5
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ You can use the ``url()`` function, instead of a tuple, as an argument to
227227
optional extra arguments dictionary. For example::
228228

229229
urlpatterns = patterns('',
230-
url(r'/index/$', index_view, name="main-view"),
230+
url(r'^index/$', index_view, name="main-view"),
231231
...
232232
)
233233

@@ -539,8 +539,8 @@ your URLconf. For example, these two URL patterns both point to the ``archive``
539539
view::
540540

541541
urlpatterns = patterns('',
542-
(r'/archive/(\d{4})/$', archive),
543-
(r'/archive-summary/(\d{4})/$', archive, {'summary': True}),
542+
(r'^archive/(\d{4})/$', archive),
543+
(r'^archive-summary/(\d{4})/$', archive, {'summary': True}),
544544
)
545545

546546
This is completely valid, but it leads to problems when you try to do reverse
@@ -557,8 +557,8 @@ matching.
557557
Here's the above example, rewritten to use named URL patterns::
558558

559559
urlpatterns = patterns('',
560-
url(r'/archive/(\d{4})/$', archive, name="full-archive"),
561-
url(r'/archive-summary/(\d{4})/$', archive, {'summary': True}, "arch-summary"),
560+
url(r'^archive/(\d{4})/$', archive, name="full-archive"),
561+
url(r'^archive-summary/(\d{4})/$', archive, {'summary': True}, "arch-summary"),
562562
)
563563

564564
With these names in place (``full-archive`` and ``arch-summary``), you can

0 commit comments

Comments
 (0)