Fixed #54 -- Corrected typos in urlconfs in docs/overview. Thanks, james!

git-svn-id: http://code.djangoproject.com/svn/django/trunk@191 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Adrian Holovaty 2005-07-19 02:22:11 +00:00
parent 8f4fa5a4e7
commit 2363af5782
1 changed files with 4 additions and 5 deletions

View File

@ -169,13 +169,12 @@ Reporter/Article example, here's what that might look like::
from django.conf.urls.defaults import * from django.conf.urls.defaults import *
urlpatterns = patterns('', urlpatterns = patterns('',
(r'^/articles/(?P\d{4})/$', 'myproject.news.views.articles.year_archive'), (r'^/articles/(?P\d<year>{4})/$', 'myproject.news.views.articles.year_archive'),
(r'^/articles/(?P\d{4})/(?P\d{2})/$', 'myproject.news.views.articles.month_archive'), (r'^/articles/(?P\d<year>{4})/(?P\d<month>{2})/$', 'myproject.news.views.articles.month_archive'),
(r'^/articles/(?P\d{4})/(?P\d{2})/$', 'myproject.news.views.articles.month_archive'), (r'^/articles/(?P\d<year>{4})/(?P\d<month>{2})/$', 'myproject.news.views.articles.month_archive'),
(r'^/articles/(?P\d{4})/(?P\d{2})/(?P\d+)/$', 'myproject.news.views.articles.article_detail'), (r'^/articles/(?P\d<year>{4})/(?P\d<month>{2})/(?P<day>\d+)/$', 'myproject.news.views.articles.article_detail'),
) )
The code above maps URLs, as regular expressions, to the location of Python The code above maps URLs, as regular expressions, to the location of Python
callback functions (views). The regular expressions use parenthesis to "capture" callback functions (views). The regular expressions use parenthesis to "capture"
values from the URLs. When a user requests a page, Django runs through each values from the URLs. When a user requests a page, Django runs through each