Opened 7 months ago
Closed 7 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 , 7 months ago
Owner: | changed from | to
---|---|
Status: | new → assigned |
comment:2 by , 7 months ago
Component: | Uncategorized → Documentation |
---|---|
Resolution: | → invalid |
Status: | assigned → closed |
Type: | Cleanup/optimization → Bug |
The polls prefix comes from
mysite/urls.py
. See tutorial 1.