Opened 6 months ago

Closed 6 months ago

#35490 closed Bug (invalid)

Writing your first Django app, part 3

Reported by: Michael Huis Owned by: sammy20d
Component: Documentation Version: 5.0
Severity: Normal Keywords: tutorial03
Cc: Michael Huis Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I think the code in a example needs to be adjusted.

Under "Writing more views¶"

from django.urls import path

from . import views

urlpatterns = [

# ex: /polls/
path("", views.index, name="index"),
# ex: /polls/5/
path("<int:question_id>/", views.detail, name="detail"),
# ex: /polls/5/results/
path("<int:question_id>/results/", views.results, name="results"),
# ex: /polls/5/vote/
path("<int:question_id>/vote/", views.vote, name="vote"),

]

I think it should be:

from django.urls import path

from . import views

urlpatterns = [

# ex: /polls/
path("", views.index, name="index"),
# ex: /polls/5/
path("polls/<int:question_id>/", views.detail, name="detail"),
# ex: /polls/5/results/
path("polls/<int:question_id>/results/", views.results, name="results"),
# ex: /polls/5/vote/
path("polls/<int:question_id>/vote/", views.vote, name="vote"),

]

the polls page wasnt added.

Change History (2)

comment:1 by sammy20d, 6 months ago

Owner: changed from nobody to sammy20d
Status: newassigned

comment:2 by Tim Graham, 6 months ago

Component: UncategorizedDocumentation
Resolution: invalid
Status: assignedclosed
Type: Cleanup/optimizationBug

The polls prefix comes from mysite/urls.py. See tutorial 1.

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