Opened 11 years ago
Closed 11 years ago
#20621 closed Bug (worksforme)
tutorial 04 imports polls namespace while within polls
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | Documentation | Version: | 1.5 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | yes | UI/UX: | no |
Description
Tutorial 4 (for Django 1.5) has update 'polls/detail.html' to contain a form which posts to
{% url 'polls:vote' poll.id %}
However 'polls/detail.html' is in the polls app/namespace (and so the identifier {{{polls}} is not defined) resulting in the error message:
u'polls' is not a registered namespace
removing polls:
so that the URL reads
{% url 'vote' poll.id %}
fixes the issue.
Change History (2)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Resolution: | → worksforme |
---|---|
Status: | new → closed |
Hi,
The namespacing of URLs is introduced at the end of part 3 [1].
Make sure you add namespace='polls'
to the include
call in the urls.py
, and it should work (I've just tried it).
Thanks.
[1] https://docs.djangoproject.com/en/1.5/intro/tutorial03/#namespacing-url-names
I just realized the documentation has the same issues in the definition of
vote()
inview.py
and alsopolls/results.html
.