Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#18705 closed Uncategorized (invalid)

Tutorial - URL Template Tag Error

Reported by: max@… Owned by: nobody
Component: Documentation Version: 1.4
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I'm working through the tutorial, and on the following page:

https://docs.djangoproject.com/en/dev/intro/tutorial03/

there is an error in the code in the final paragraph. We are instructed to use the following line to make use of the URL template helper:

<li><a href="{% url 'polls.views.detail' poll.id %}">{{ poll.question }}</a></li>

However, the single quotes around 'polls.views.detail' result in a 'No Reverse Match' error. I found that removing the single quotes, giving:

<li><a href="{% url polls.views.detail poll.id %}">{{ poll.question }}</a></li>

worked without producing the error.

Change History (2)

comment:1 Changed 3 years ago by aaugustin

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to invalid
  • Status changed from new to closed

You're using Django 1.4 but reading the documentation for the development version.

Use the version switcher at the bottom right of the docs to read the right version for your Django installation.

comment:2 Changed 3 years ago by Aymeric Augustin <aymeric.augustin@…>

In [4da1d0fd65e01abe013e0d5a9174b81c6bbfa677]:

Added a warning about the {% url %} syntax change

at the point where it bites most beginners.

Refs #18787, #18762, #18756, #18723, #18705, #18689 and several duplicates.

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