Skip to content

Instantly share code, notes, and snippets.

@vitorfs
Created August 19, 2016 22:13
Show Gist options
  • Save vitorfs/75c7ef6641999e793a9539936e775481 to your computer and use it in GitHub Desktop.
Save vitorfs/75c7ef6641999e793a9539936e775481 to your computer and use it in GitHub Desktop.
Example
from django.contrib.auth.views import login as auth_login
from django.shortcuts import redirect
def login(request):
if request.user.is_author():
return redirect('/author/')
elif request.user.is_reader():
return redirect('/reader/')
defaults = {
'authentication_form': CustomAuthenticationForm,
'template_name': 'core/login.html',
}
return auth_login(request, **defaults)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment