I have a view for logout,now I wanna when user click on an anchor link the logout view run,how can I do this?
in views.py:
def logout(request):
auth.logout(request)
return render_to_response("airAgency/index.html")
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Logging out via a link instead of a form is easy.
https://docs.djangoproject.com/en/dev/topics/auth/#django.contrib.auth.logout
Just point a url to this view like you did with your form and go to that URL.