I was reading below mentioned blog which is about Built-in permissions in DRF
Source: https://testdriven.io/blog/built-in-permission-classes-drf/
In this blog there is statement:
DEFAULT_PERMISSION_CLASSES will only work for the views or objects that don't have permissions explicitly set.
You don't necessarily need to use built-in classes here. You can use your own custom classes as well.
Question: What does set permissions explicitly
means?
CodePudding user response:
it means telling django which permission class it should use for this specific view
in this example I'm telling django to use the IsAuthenticated
class rather
than using the default permissions class which is defined in the settings.py file
class ExampleView(APIView):
permission_classes = [IsAuthenticated]
def get(self, request, format=None):
content = {
'status': 'request was permitted'
}
return Response(content)