add none check for user

If user never sign in, or there is no user in request. It throw exception.
This commit is contained in:
Alex 2017-03-22 23:04:04 -07:00 committed by GitHub
parent 0fdaf4f481
commit 3b3e3983e9

View File

@ -128,6 +128,8 @@ def _resolve_model(obj):
def is_authenticated(user):
if not user:
return False
if django.VERSION < (1, 10):
return user.is_authenticated()
return user.is_authenticated