Author: mtredinnick
Date: 2008-11-16 03:38:40 -0600 (Sun, 16 Nov 2008)
New Revision: 9472
Modified:
django/branches/releases/1.0.X/docs/topics/http/urls.txt
Log:
[1.0.X] Fixed #9472 -- Fixed a couple of URL patterns to be more consistent
(and remove a misleading initial slash). Thanks, daveyjoe.
Backport of r9471 from trunk.
Modified: django/branches/releases/1.0.X/docs/topics/http/urls.txt
===================================================================
--- django/branches/releases/1.0.X/docs/topics/http/urls.txt 2008-11-16
09:35:30 UTC (rev 9471)
+++ django/branches/releases/1.0.X/docs/topics/http/urls.txt 2008-11-16
09:38:40 UTC (rev 9472)
@@ -227,7 +227,7 @@
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 @@
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 @@
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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---