Skip to content

Commit

Permalink
Fixed #16169 -- Updated tutorial to match the current project templat…
Browse files Browse the repository at this point in the history
…e, specifically the urls.py. Thanks, aaugustin.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@16463 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information
jezdez committed Jun 26, 2011
1 parent e013991 commit 8882c55
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 17 deletions.
14 changes: 7 additions & 7 deletions docs/intro/tutorial02.txt
Expand Up @@ -40,22 +40,22 @@ activate the admin site for your installation, do these three things:

.. parsed-literal::

from django.conf.urls.defaults import *
from django.conf.urls.defaults import patterns, include, url

# Uncomment the next two lines to enable the admin:
**from django.contrib import admin**
**admin.autodiscover()**

urlpatterns = patterns('',
# Example:
# (r'^mysite/', include('mysite.foo.urls')),
# Examples:
# url(r'^$', '{{ project_name }}.views.home', name='home'),
# url(r'^{{ project_name }}/', include('{{ project_name }}.foo.urls')),

# Uncomment the admin/doc line below and add 'django.contrib.admindocs'
# to INSTALLED_APPS to enable admin documentation:
# (r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Uncomment the admin/doc line below to enable admin documentation:
# url(r'^admin/doc/', include('django.contrib.admindocs.urls')),

# Uncomment the next line to enable the admin:
**(r'^admin/', include(admin.site.urls)),**
**url(r'^admin/', include(admin.site.urls)),**
)

(The bold lines are the ones that needed to be uncommented.)
Expand Down
16 changes: 8 additions & 8 deletions docs/intro/tutorial03.txt
Expand Up @@ -78,7 +78,7 @@ point at that file::

Time for an example. Edit ``mysite/urls.py`` so it looks like this::

from django.conf.urls.defaults import *
from django.conf.urls.defaults import patterns, include, url

from django.contrib import admin
admin.autodiscover()
Expand All @@ -88,7 +88,7 @@ Time for an example. Edit ``mysite/urls.py`` so it looks like this::
(r'^polls/(?P<poll_id>\d+)/$', 'polls.views.detail'),
(r'^polls/(?P<poll_id>\d+)/results/$', 'polls.views.results'),
(r'^polls/(?P<poll_id>\d+)/vote/$', 'polls.views.vote'),
(r'^admin/', include(admin.site.urls)),
url(r'^admin/', include(admin.site.urls)),
)

This is worth a review. When somebody requests a page from your Web site -- say,
Expand Down Expand Up @@ -366,7 +366,7 @@ It's just a normal view.
You normally won't have to bother with writing 404 views. By default, URLconfs
have the following line up top::

from django.conf.urls.defaults import *
from django.conf.urls.defaults import patterns, include, url

That takes care of setting ``handler404`` in the current module. As you can see
in ``django/conf/urls/defaults.py``, ``handler404`` is set to
Expand Down Expand Up @@ -459,7 +459,7 @@ callback in your URLconf, you can concatenate multiple
:func:`~django.conf.urls.defaults.patterns`. Your full ``mysite/urls.py`` might
now look like this::

from django.conf.urls.defaults import *
from django.conf.urls.defaults import patterns, include, url

from django.contrib import admin
admin.autodiscover()
Expand All @@ -472,7 +472,7 @@ now look like this::
)

urlpatterns += patterns('',
(r'^admin/', include(admin.site.urls)),
url(r'^admin/', include(admin.site.urls)),
)

Decoupling the URLconfs
Expand All @@ -496,14 +496,14 @@ Copy the file ``mysite/urls.py`` to ``polls/urls.py``. Then, change
:func:`~django.conf.urls.defaults.include`, leaving you with::

# This also imports the include function
from django.conf.urls.defaults import *
from django.conf.urls.defaults import patterns, include, url

from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
(r'^polls/', include('polls.urls')),
(r'^admin/', include(admin.site.urls)),
url(r'^admin/', include(admin.site.urls)),
)

:func:`~django.conf.urls.defaults.include` simply references another URLconf.
Expand All @@ -526,7 +526,7 @@ URLconf by removing the leading "polls/" from each line, and removing the
lines registering the admin site. Your ``polls/urls.py`` file should now look like
this::

from django.conf.urls.defaults import *
from django.conf.urls.defaults import patterns, include, url

urlpatterns = patterns('polls.views',
(r'^$', 'index'),
Expand Down
4 changes: 2 additions & 2 deletions docs/intro/tutorial04.txt
Expand Up @@ -218,7 +218,7 @@ Read on for details.
First, open the ``polls/urls.py`` URLconf. It looks like this, according to the
tutorial so far::

from django.conf.urls.defaults import *
from django.conf.urls.defaults import patterns, include, url

urlpatterns = patterns('polls.views',
(r'^$', 'index'),
Expand All @@ -229,7 +229,7 @@ tutorial so far::

Change it like so::

from django.conf.urls.defaults import *
from django.conf.urls.defaults import patterns, include, url
from django.views.generic import DetailView, ListView
from polls.models import Poll

Expand Down

0 comments on commit 8882c55

Please sign in to comment.