I am using Django 1.5.1 using the standard Django authentication system.
INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'django.contrib.markup', 'django.contrib.admindocs', 'flowcharts', 'south', 'helpdesk', )
Here is the template located in the / login registration:
{% extends "base.html" %} {% 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 %}
and in my urls.py file:
urlpatterns = patterns('', url(r'^accounts/login/$', 'django.contrib.auth.views.login'), url(r'^accounts/logout/$', 'django.contrib.auth.views.logout' , {'next_page': '/accounts/login/'}), )
The form action is a mapping to '/ helpdesk / login /'
But when I run render ('django.contrib.auth.views.login') in the python shell, I get '/ accounts / login /', which is the URL that I want to point to the form. Let me know if any other project information is needed.
source share