Advertisement
Guest User

Untitled

a guest
Oct 3rd, 2017
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.58 KB | None | 0 0
  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/')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement