Fixed #4817 -- Removed leading forward slashes from some urlconf examples in the documentation.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@5638 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
5a32b3ac2c
commit
0be6d32c24
|
@ -1871,7 +1871,7 @@ works out the correct full URL path using the URLconf, substituting the
|
|||
parameters you have given into the URL. For example, if your URLconf
|
||||
contained a line such as::
|
||||
|
||||
(r'^/people/(\d+)/$', 'people.views.details'),
|
||||
(r'^people/(\d+)/$', 'people.views.details'),
|
||||
|
||||
...your model could have a ``get_absolute_url`` method that looked like this::
|
||||
|
||||
|
|
|
@ -165,9 +165,9 @@ example above::
|
|||
from django.conf.urls.defaults import *
|
||||
|
||||
urlpatterns = patterns('',
|
||||
(r'^/articles/(\d{4})/$', 'mysite.views.year_archive'),
|
||||
(r'^/articles/(\d{4})/(\d{2})/$', 'mysite.views.month_archive'),
|
||||
(r'^/articles/(\d{4})/(\d{2})/(\d+)/$', 'mysite.views.article_detail'),
|
||||
(r'^articles/(\d{4})/$', 'mysite.views.year_archive'),
|
||||
(r'^articles/(\d{4})/(\d{2})/$', 'mysite.views.month_archive'),
|
||||
(r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'mysite.views.article_detail'),
|
||||
)
|
||||
|
||||
The code above maps URLs, as simple regular expressions, to the location of
|
||||
|
|
|
@ -103,10 +103,10 @@ Do this by wrapping an ``if DEBUG`` statement around the
|
|||
from django.conf import settings
|
||||
|
||||
urlpatterns = patterns('',
|
||||
(r'^/articles/2003/$', 'news.views.special_case_2003'),
|
||||
(r'^/articles/(?P<year>\d{4})/$', 'news.views.year_archive'),
|
||||
(r'^/articles/(?P<year>\d{4})/(?P<month>\d{2})/$', 'news.views.month_archive'),
|
||||
(r'^/articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d+)/$', 'news.views.article_detail'),
|
||||
(r'^articles/2003/$', 'news.views.special_case_2003'),
|
||||
(r'^articles/(?P<year>\d{4})/$', 'news.views.year_archive'),
|
||||
(r'^articles/(?P<year>\d{4})/(?P<month>\d{2})/$', 'news.views.month_archive'),
|
||||
(r'^articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d+)/$', 'news.views.article_detail'),
|
||||
)
|
||||
|
||||
if settings.DEBUG:
|
||||
|
|
|
@ -317,7 +317,7 @@ Old::
|
|||
from django.conf.urls.defaults import *
|
||||
|
||||
urlpatterns = patterns('',
|
||||
(r'^/?$', 'django.views.generic.date_based.archive_index'),
|
||||
(r'^$', 'django.views.generic.date_based.archive_index'),
|
||||
(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 'django.views.generic.date_based.archive_month'),
|
||||
(r'^tag/(?P<tag>\w+)/$', 'weblog.views.tag'),
|
||||
)
|
||||
|
@ -327,7 +327,7 @@ New::
|
|||
from django.conf.urls.defaults import *
|
||||
|
||||
urlpatterns = patterns('django.views.generic.date_based',
|
||||
(r'^/?$', 'archive_index'),
|
||||
(r'^$', 'archive_index'),
|
||||
(r'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$','archive_month'),
|
||||
)
|
||||
|
||||
|
@ -392,7 +392,7 @@ dictionary of extra keyword arguments to pass to the view function.
|
|||
For example::
|
||||
|
||||
urlpatterns = patterns('blog.views',
|
||||
(r'^/blog/(?P<year>\d{4})/$', 'year_archive', {'foo': 'bar'}),
|
||||
(r'^blog/(?P<year>\d{4})/$', 'year_archive', {'foo': 'bar'}),
|
||||
)
|
||||
|
||||
In this example, for a request to ``/blog/2005/``, Django will call the
|
||||
|
|
Loading…
Reference in New Issue