mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-08-04 20:40:14 +03:00
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:
parent
0fdaf4f481
commit
3b3e3983e9
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user