Django

Code

Ticket #11328 (closed: fixed)

Opened 9 months ago

Last modified 9 months ago

Bug in tutorial03

Reported by: marcalj Assigned to: nobody
Milestone: 1.1 Component: Documentation
Version: 1.0 Keywords:
Cc: Triage Stage: Accepted
Has patch: 0 Needs documentation: 0
Needs tests: 0 Patch needs improvement: 0

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

Change History

06/16/09 19:19:14 changed by russellm

  • needs_better_patch changed.
  • needs_docs changed.
  • stage changed from Unreviewed to Accepted.
  • needs_tests changed.
  • milestone changed from 1.0.3 to 1.1.

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)

06/17/09 08:46:53 changed by russellm

  • status changed from new to closed.
  • resolution set to fixed.

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

06/17/09 08:52:06 changed 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.


Add/Change #11328 (Bug in tutorial03)




Change Properties
Action