added request.method == 'options'

This commit is contained in:
mkdk 2018-09-19 23:08:40 +03:00
parent b090ae9d30
commit 953c29c12d

View File

@ -44,8 +44,10 @@ class IsAuthenticated(BasePermission):
""" """
Allows access only to authenticated users. Allows access only to authenticated users.
""" """
# DRF should authorize all OPTIONS requests by default #5616
def has_permission(self, request, view): def has_permission(self, request, view):
if request.method == 'OPTIONS':
return True
return request.user and request.user.is_authenticated return request.user and request.user.is_authenticated