Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

django logout

from django.contrib.auth import logout

def logout_view(request):
    logout(request)
    # Redirect to a success page.
Comment

django logout

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 ###
Comment

django logout page

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.
Comment

how to logout in django

from django.contrib.auth import logout

def logout_view(request):
    logout(request)
    # Redirect to a success page.
Comment

PREVIOUS NEXT
Code Example
Python :: max of three numbers in python 
Python :: python find object with attribute in list 
Python :: Pandas categorical dtypes 
Python :: how to sort a dictionary using pprint module in python 
Python :: how to detect when a key is pressed in pygame 
Python :: how to do swapping in python without 
Python :: random library python 
Python :: sending whatsapp message using python 
Python :: remove element from list 
Python :: cv2.namedWindow 
Python :: python string: iterate string 
Python :: add x=y line to scatter plot python 
Python :: count number of each item in list python 
Python :: what is wsgi 
Python :: cut rows dataframe 
Python :: how to uninstall python2.7 from ubuntu 18.04 
Python :: python for loop one line 
Python :: how does urllib.parse.urlsplit work in python 
Python :: get page title by python bs4 
Python :: concatenate python 
Python :: odd or even python 
Python :: import csrf_exempt django 
Python :: get token from request django 
Python :: python keep value recursive function 
Python :: virtual env python 2 
Python :: clean column names pandas 
Python :: git help 
Python :: how to convert all items in a list to integer python 
Python :: convert timedelta to int 
Python :: how to remove duplicates from a python list 
ADD CONTENT
Topic
Content
Source link
Name
2+2 =