From ed63f6eee39fd8a2be552524fd02957b47621105 Mon Sep 17 00:00:00 2001 From: Christophe Duvernois Date: Thu, 8 Jun 2017 18:46:25 +0200 Subject: [PATCH] fix APIView.permission_denied : NotAuthenticated exception can use user defined message --- rest_framework/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rest_framework/views.py b/rest_framework/views.py index 8ec5f14ab..a3baf2237 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -167,7 +167,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):