Y. Postema Y. Postema - 2 months ago 24x
Python Question

Error NoReverseMatch

I keep running in to a

error on Django 1.10, while earlier versions have no problems with it.

rendered template:

{% extends "loginBase.html" %}

{% block content %}

<form class="form-horizontal" role="form" method="post" action="{% url 'django.contrib.auth.views.login' %}">
{% csrf_token %}
{% if form.errors %}
<p>Your username and password didn't match. Please try again.</p>
{% endif %}


url(r'^login/$', views.login, {'template_name': 'login.html', 'authentication_form': LoginForm}, name='login'),

Any ideas on what the problem might be?


In Django 1.10, you can no longer reverse URLs using the Python dotted path, e.g. 'django.contrib.auth.views.login'.

You already have name='login' in your URL pattern,

url(r'^login/$', views.login, {...}, name='login'),

so use that in the url tag:

{% url 'login' %}