I am trying to implement a login page using the django login view, here is the code:
urls.py
urlpatterns = patterns(
'',
url(r'^login/$', 'django.contrib.auth.views.login'),
url(r'^logout/$', 'django.contrib.auth.views.logout'),
)
and pattern:
login.html
{% extends 'base_cost_control.html' %}
{% block contentbase %}
{% if form.errors %}
<p>Invalid user or password</p>
{% endif %}
<form method="post" action="{% url 'django.contrib.auth.views.login' %}">
{% csrf_token %}
<div class="row" align="center">
<br>
<br>
<h3> CONTROL DE COSTOS </h3>
<br><br>
<table>
<tr>
<td width=700px>{%include "partials/field.html" with field=form.username %}</td>
</tr>
<tr>
<td width=700px>{%include "partials/field.html" with field=form.password %}</td>
</tr>
<tr>
<td align="right"><input type="submit" class="btn btn-info" name = "siguiente" id="siguiente" value="Ingresar"/></td>
</tr>
</table>
</div>
</form>
{% endblock contentbase %}
So, I know django.contrib, auth.views.login generates a view, and I need to create a login.html template, but I get this error in line 8 in login.html:
Reverse for 'login' with arguments '()' and keyword arguments '{}' not found. 0 pattern(s) tried: []
I do not know what else to do ...
source
share