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:
Gary Wilson Jr 2007-07-10 02:34:42 +00:00
parent 5a32b3ac2c
commit 0be6d32c24
4 changed files with 11 additions and 11 deletions

View File

@ -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 parameters you have given into the URL. For example, if your URLconf
contained a line such as:: 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:: ...your model could have a ``get_absolute_url`` method that looked like this::

View File

@ -165,9 +165,9 @@ example above::
from django.conf.urls.defaults import * from django.conf.urls.defaults import *
urlpatterns = patterns('', urlpatterns = patterns('',
(r'^/articles/(\d{4})/$', 'mysite.views.year_archive'), (r'^articles/(\d{4})/$', 'mysite.views.year_archive'),
(r'^/articles/(\d{4})/(\d{2})/$', 'mysite.views.month_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})/(\d{2})/(\d+)/$', 'mysite.views.article_detail'),
) )
The code above maps URLs, as simple regular expressions, to the location of The code above maps URLs, as simple regular expressions, to the location of

View File

@ -103,10 +103,10 @@ Do this by wrapping an ``if DEBUG`` statement around the
from django.conf import settings from django.conf import settings
urlpatterns = patterns('', urlpatterns = patterns('',
(r'^/articles/2003/$', 'news.views.special_case_2003'), (r'^articles/2003/$', 'news.views.special_case_2003'),
(r'^/articles/(?P<year>\d{4})/$', 'news.views.year_archive'), (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})/$', 'news.views.month_archive'),
(r'^/articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d+)/$', 'news.views.article_detail'), (r'^articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d+)/$', 'news.views.article_detail'),
) )
if settings.DEBUG: if settings.DEBUG:

View File

@ -317,7 +317,7 @@ Old::
from django.conf.urls.defaults import * from django.conf.urls.defaults import *
urlpatterns = patterns('', 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'^(?P<year>\d{4})/(?P<month>[a-z]{3})/$', 'django.views.generic.date_based.archive_month'),
(r'^tag/(?P<tag>\w+)/$', 'weblog.views.tag'), (r'^tag/(?P<tag>\w+)/$', 'weblog.views.tag'),
) )
@ -327,7 +327,7 @@ New::
from django.conf.urls.defaults import * from django.conf.urls.defaults import *
urlpatterns = patterns('django.views.generic.date_based', 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'), (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:: For example::
urlpatterns = patterns('blog.views', 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 In this example, for a request to ``/blog/2005/``, Django will call the