Opened 16 years ago

Closed 16 years ago

Last modified 13 years ago

#11328 closed (fixed)

Bug in tutorial03

Reported by: Marçal Juan Llaó Owned by: nobody
Component: Documentation Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

http://docs.djangoproject.com/en/1.0/intro/tutorial03/#design-your-urls

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

There's a sample code for file named "mysite/urls.py":

from django.conf.urls.defaults import *

urlpatterns = patterns('',
    (r'^polls/$', 'mysite.polls.views.index'),
    (r'^polls/(?P<poll_id>\d+)/$', 'mysite.polls.views.detail'),
    (r'^polls/(?P<poll_id>\d+)/results/$', 'mysite.polls.views.results'),
    (r'^polls/(?P<poll_id>\d+)/vote/$', 'mysite.polls.views.vote'),
    (r'^admin/(.*)', admin.site.root),
)

Should be:

from django.conf.urls.defaults import *

urlpatterns = patterns('',
    (r'^polls/$', 'mysite.polls.views.index'),
    (r'^polls/(?P<poll_id>\d+)/$', 'mysite.polls.views.detail'),
    (r'^polls/(?P<poll_id>\d+)/results/$', 'mysite.polls.views.results'),
    (r'^polls/(?P<poll_id>\d+)/vote/$', 'mysite.polls.views.vote'),
)

The line with admin route is invalid without their include, etc. It raises 500 error.

Thanks.

Change History (4)

comment:1 by Russell Keith-Magee, 16 years ago

milestone: 1.0.31.1
Triage Stage: UnreviewedAccepted

Well spotted. The real solution here is to include the extra import lines, rather than remove the admin registration; these lines seem to have been lost in the transition from tutorial 2. This should be fixed ASAP, so I'm promoting to the v1.1 milestone (although it needs a different backport for v1.0.X)

comment:2 by Russell Keith-Magee, 16 years ago

Resolution: fixed
Status: newclosed

(In [11021]) Fixed #11328 -- Added missing imports in the sample urls.py from Tutorial 3. Thanks to marcalj for the report.

comment:3 by Russell Keith-Magee, 16 years ago

(In [11023]) [1.0.X] Fixed #11328 -- Added missing imports in the sample urls.py from Tutorial 3. Thanks to marcalj for the report.

Merge of r11021 from trunk.

comment:4 by Jacob, 13 years ago

milestone: 1.1

Milestone 1.1 deleted

Note: See TracTickets for help on using tickets.
Back to Top