Updated url dispatch docs to make it more clear that the prefix need not end in a dot

git-svn-id: http://code.djangoproject.com/svn/django/trunk@282 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
Jacob Kaplan-Moss 2005-07-21 18:12:29 +00:00
parent df6feb54f2
commit 96d69c5b5f
1 changed files with 6 additions and 2 deletions

View File

@ -21,7 +21,6 @@ Here's the example from that overview::
urlpatterns = patterns('', urlpatterns = patterns('',
(r'^/articles/(?P<year>\d{4})/$', 'myproject.news.views.articles.year_archive'), (r'^/articles/(?P<year>\d{4})/$', 'myproject.news.views.articles.year_archive'),
(r'^/articles/(?P<year>\d{4})/(?P<month>\d{2})/$', 'myproject.news.views.articles.month_archive'), (r'^/articles/(?P<year>\d{4})/(?P<month>\d{2})/$', 'myproject.news.views.articles.month_archive'),
(r'^/articles/(?P<year>\d{4})/(?P<month>\d{2})/$', 'myproject.news.views.articles.month_archive'),
(r'^/articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d+)/$', 'myproject.news.views.articles.article_detail'), (r'^/articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d+)/$', 'myproject.news.views.articles.article_detail'),
) )
@ -33,10 +32,15 @@ above example could be written more concisely as::
urlpatterns = patterns('myproject.news.views.articles', urlpatterns = patterns('myproject.news.views.articles',
(r'^/articles/(?P<year>\d{4})/$', 'year_archive'), (r'^/articles/(?P<year>\d{4})/$', 'year_archive'),
(r'^/articles/(?P<year>\d{4})/(?P<month>\d{2})/$', 'month_archive'), (r'^/articles/(?P<year>\d{4})/(?P<month>\d{2})/$', 'month_archive'),
(r'^/articles/(?P<year>\d{4})/(?P<month>\d{2})/$', 'month_archive'),
(r'^/articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d+)/$', 'article_detail'), (r'^/articles/(?P<year>\d{4})/(?P<month>\d{2})/(?P<day>\d+)/$', 'article_detail'),
) )
.. admonition:: Note
More precisely, the actual view function use is ``prefix + "." +
function_name``; that is, the trailing "dot" does not need to be put in the
prefix. Django: saving you time, one keystroke at a time.
Including other URLconfs Including other URLconfs
======================== ========================