Update views.py

message field of Permission class is not going to be ignored when the user is not authenticated
This commit is contained in:
Yaser Amiri 2018-08-09 12:17:43 +04:30 committed by GitHub
parent 81fa4b4f75
commit 51d5fde5c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -173,7 +173,7 @@ class APIView(View):
If request is not permitted, determine what kind of exception to raise.
"""
if request.authenticators and not request.successful_authenticator:
raise exceptions.NotAuthenticated()
raise exceptions.NotAuthenticated(detail=message)
raise exceptions.PermissionDenied(detail=message)
def throttled(self, request, wait):