#20621 closed Bug (worksforme)

tutorial 04 imports polls namespace while within polls

Reported by: eitanm@… 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 Changed 21 months ago by anonymous

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

I just realized the documentation has the same issues in the definition of vote() in view.py and also polls/results.html.

comment:2 Changed 21 months ago by bmispelon

  • Resolution set to worksforme
  • Status changed from new to 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

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