Code

Opened 5 years ago

Closed 5 years ago

Last modified 3 years ago

#11328 closed (fixed)

Bug in tutorial03

Reported by: marcalj 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: UI/UX:

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.

Attachments (0)

Change History (4)

comment:1 Changed 5 years ago by russellm

  • milestone changed from 1.0.3 to 1.1
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

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 Changed 5 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

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

comment:3 Changed 5 years ago by russellm

(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 Changed 3 years ago by jacob

  • milestone 1.1 deleted

Milestone 1.1 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.