mirror of
https://github.com/django/django.git
synced 2025-07-24 05:36:15 +00:00
Fixed #14426 -- Removed "mysite" import statements from examples that might teach people "bad habits" in regards to creating reusable apps.
git-svn-id: http://code.djangoproject.com/svn/django/trunk@14270 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
2790cf482d
commit
7baee5b953
7 changed files with 27 additions and 25 deletions
|
@ -338,12 +338,12 @@ Here's the example URLconf from the :doc:`Django overview </intro/overview>`::
|
|||
from django.conf.urls.defaults import *
|
||||
|
||||
urlpatterns = patterns('',
|
||||
(r'^articles/(\d{4})/$', 'mysite.news.views.year_archive'),
|
||||
(r'^articles/(\d{4})/(\d{2})/$', 'mysite.news.views.month_archive'),
|
||||
(r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'mysite.news.views.article_detail'),
|
||||
(r'^articles/(\d{4})/$', 'news.views.year_archive'),
|
||||
(r'^articles/(\d{4})/(\d{2})/$', 'news.views.month_archive'),
|
||||
(r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'news.views.article_detail'),
|
||||
)
|
||||
|
||||
In this example, each view has a common prefix -- ``'mysite.news.views'``.
|
||||
In this example, each view has a common prefix -- ``'news.views'``.
|
||||
Instead of typing that out for each entry in ``urlpatterns``, you can use the
|
||||
first argument to the ``patterns()`` function to specify a prefix to apply to
|
||||
each view function.
|
||||
|
@ -352,7 +352,7 @@ With this in mind, the above example can be written more concisely as::
|
|||
|
||||
from django.conf.urls.defaults import *
|
||||
|
||||
urlpatterns = patterns('mysite.news.views',
|
||||
urlpatterns = patterns('news.views',
|
||||
(r'^articles/(\d{4})/$', 'year_archive'),
|
||||
(r'^articles/(\d{4})/(\d{2})/$', 'month_archive'),
|
||||
(r'^articles/(\d{4})/(\d{2})/(\d+)/$', 'article_detail'),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue