Update views.py

Override APIView get_permissions
This commit is contained in:
HamidReza Sadeghzadeh 2023-03-06 15:53:25 +03:30 committed by GitHub
parent b7523f4b9f
commit 54e9c37f5b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -275,7 +275,11 @@ class APIView(View):
""" """
Instantiates and returns the list of permissions that this view requires. 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): def get_throttles(self):
""" """