Render('django.contrib.auth.views.login') Pointing To Different Url Than {% Url 'django.contrib.auth.views.login' %}
I'm on Django 1.5.1 using the default implementation of the Django authentication system. INSTALLED_APPS = ( 'django.contrib.auth', 'django.contrib.contenttypes', 'djan
Solution 1:
You want to use django authentication system:
Have this in your urls.py:
urlpatterns = patterns('',
url(r'^accounts/', include('django.contrib.auth.urls'))
)
In your registration/login.html:
<form method="post" action="{% url login %}">
You want to provide a next_url in the logout, so whenever you want to call logout:
<a href="{% url logout %}?next=/accounts/login/">Logout</a>
Check line 191 of the link you pointed. They name /helpdesk/login/
as login
and so your {% url login %}
points to /helpdesk/login
.
You must be having url(r'^helpdesk/', include('helpdesk.urls'))
before url(r'^accounts/', include('django.contrib.auth.urls'))
in your urls.py
. Change the order of these two urls.
Solution 2:
this is what im using and getting it correct
<li><a href="{% url django.contrib.auth.views.login %}?next={{request.path}}">Login</a></li>
so i guess you have to remove the single quotes
Post a Comment for "Render('django.contrib.auth.views.login') Pointing To Different Url Than {% Url 'django.contrib.auth.views.login' %}"