1π
To logout use POST instead of GET. It is a architecture issue.
So to logout you should make a post request like the following example.
Logout template form
<form action="{% url 'logout' %}" method="post" >
{% csrf_token %}
<input type="submit" value="Logout" />
</form>
Logout url
urlpatterns = patterns('',
url(r'^logout/$', LogoutView.as_view(), name='logout'),
# other urls...
)
Logout view
from django.contrib.auth import logout
class LogoutView(ProcessFormView):
def post(self, request, *args, **kwargs):
logout(request)
return redirect('login-url-name')
π€Rhemzo
0π
Example logout
@require_POST
def logout(request):
auth.logout(request)
return redirect('/')
π€rebelius
- [Answer]-Export many-to-many relations of object in admin with Django Import-Export
- [Answer]-How do I access POST data in overriden form save method?
Source:stackexchange.com