Django - Custom permissions for function based views
It seems like it's a known issue, has_object_permission
is not supported when using function based views, it's reported here.
If you would like to call has_permission
, you should be able to do so using the permission_classes
decorator as shown in the documentation
@api_view(['GET'])
@permission_classes((IsAuthenticated, ))
def example_view(request, format=None):
content = {
'status': 'request was permitted'
}
return Response(content)