Opened 6 years ago

Closed 6 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


The page in question is

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 %}

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


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


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

{% endblock %}

Removing the quotes fixes the error.

Change History (3)

comment:1 Changed 6 years ago by prseshad@…

comment:2 Changed 6 years ago by Simon Charette

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

comment:3 Changed 6 years ago by Aymeric Augustin

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