SHARE
TWEET

Untitled

a guest Oct 3rd, 2017 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. def loginaction(request):
  2.     #authenticate the user
  3.     username = request.POST.get('username')
  4.     password = request.POST.get('password')
  5.     user = authenticate(request,username=username, password=password)
  6.     #if user exists then check the user type:
  7.     if user is not None:
  8.         #get id so that the user_type of the user can be retrieved
  9.         login(request,user)
  10.         # based on the user_type redirect to artist or listener home
  11.         if request.user.appuser.user_type == 'ARTIST' :
  12.             return redirect('/artisthome/') # artist home
  13.         else:
  14.             return redirect('/home/') # lister home
  15.     else:
  16.         return redirect('/login1/')
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top