3👍
Override get_permissions
method on the ModelViewSet
class.
Example:
class FooViewSet(ModelViewSet):
authentication_classes = (SessionAuthentication, BasicAuthentication, )
permission_classes = (IsAuthenticated, )
def get_permissions(self):
if self.request.method != 'PUT':
return []
return super().get_permissions()
Source:stackexchange.com