Opened 12 years ago

Closed 12 years ago

#18720 closed Uncategorized (needsinfo)

Code sample for views.html template causes NoReverseMatch error

Reported by: anonymous 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

The page in question is

https://docs.djangoproject.com/en/1.4/topics/auth/

The code sample for views.html will cause a NoReverseMatchError due to the single quotes in the argument to the bolded url tag below:

{% extends "base.html" %}
{% load url from future %}

{% block content %}

{% if form.errors %}
<p>Your username and password didn't match. Please try again.</p>
{% endif %}

<form method="post" action="{% url 'django.contrib.auth.views.login' %}">
{% csrf_token %}
<table>
<tr>

<td>{{ form.username.label_tag }}</td>
<td>{{ form.username }}</td>

</tr>
<tr>

<td>{{ form.password.label_tag }}</td>
<td>{{ form.password }}</td>

</tr>
</table>

<input type="submit" value="login" />
<input type="hidden" name="next" value="{{ next }}" />
</form>

{% endblock %}

Removing the quotes fixes the error.

Change History (3)

comment:1 by prseshad@…, 12 years ago

comment:2 by Simon Charette, 12 years ago

Are you sure you put the {% load url from future %} in your template?

comment:3 by Aymeric Augustin, 12 years ago

Resolution: needsinfo
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top