from django.contrib.auth import logout
def logout_view(request):
logout(request)
# Redirect to a success page.
from django.contrib.auth import logout
def logout_view(request):
logout(request)
# Redirect to a success page.
-------------------------------------------------------------------
# add in settings.py (optional)
LOGOUT_REDIRECT_URL = url_to_be_redirected_after_logout
### if you add the LOGOUT_REDIRECT_URL you don't have to redirect to success page in the view ###
### because it will automatically redirect the user to the url you provided in settings.py ###
from django.contrib.auth import logout
def logout_view(request):
if request.method == 'POST':
logout(request)
return redirect('/login.html')
# Redirect to a success page.
from django.contrib.auth import logout
def logout_view(request):
logout(request)
# Redirect to a success page.