0

I want to add a logout href in my admin.html like:

<a href="/panel/">Log out</a>

What can I do to destroy the session when a user is redirected to /panel/ by clicking that 'Log out' link? What are the session variables to use in template files?

thank you

alioguzhan
  • 7,657
  • 10
  • 46
  • 67

1 Answers1

0

In your view do something like this

#views.py
from django.contrib.auth import logout as auth_logout

def logout(request):
    response = auth_logout(request)
    return HttpResponseRedirect('http://yourdomain.com')

#urls.py
from django.conf.urls.defaults import *

urlpatterns = patterns('',
    url(r'^panel/$', 'views.logout', name='logout'),
)
silent1mezzo
  • 2,814
  • 4
  • 26
  • 46