logout function in django code example
Example 1: django logout
from django.contrib.auth import logout
def logout_view(request):
logout(request)
# Redirect to a success page.
Example 2: how to logout in django
from django.contrib.auth import logout
def logout_view(request):
logout(request)
# Redirect to a success page.
Example 3: import login required
from django.contrib.auth.decorators import login_required