From 54e9c37f5bcdceaf2d22a2977f183171ad0bbc40 Mon Sep 17 00:00:00 2001 From: HamidReza Sadeghzadeh <79264777+HamidRezaSZ@users.noreply.github.com> Date: Mon, 6 Mar 2023 15:53:25 +0330 Subject: [PATCH] Update views.py Override APIView get_permissions --- rest_framework/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rest_framework/views.py b/rest_framework/views.py index 4c30029fd..0522262dd 100644 --- a/rest_framework/views.py +++ b/rest_framework/views.py @@ -275,7 +275,11 @@ class APIView(View): """ Instantiates and returns the list of permissions that this view requires. """ - return [permission() for permission in self.permission_classes] + try: + return [permission() for permission in self.permission_classes_by_action[self.action]] + except Exception: + return [permission() for permission in self.permission_classes] + def get_throttles(self): """