Opened 5 years ago
Closed 5 years ago
#31740 closed Bug (invalid)
Part 4 of the tutorial incorrectly uses a namespaced url
| Reported by: | Max | Owned by: | nobody |
|---|---|---|---|
| Component: | Documentation | Version: | 3.0 |
| Severity: | Normal | Keywords: | documentation, namespace, error |
| Cc: | Triage Stage: | Unreviewed | |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | yes | UI/UX: | no |
Description
I am new to using Django, but I believe I noticed an error with one of the urls in a template.
This url is used in the form:
{% url 'polls:vote' question.id %}
Despite the path definition:
path('<int:question_id>/vote/', views.vote, name='vote'),
When I do the same, I get an error as the namespace doesn't exist. This is easily fixed by removing the namespace from the template.
https://docs.djangoproject.com/en/3.0/intro/tutorial04/#write-a-minimal-form
Note:
See TracTickets
for help on using tickets.
Namespacing URL names are already described in tutorial 03, moreover
app_nameis also included in Tutorial 4. All works for me.