[Fixed]-Django Restframework has_object_permission() function is not working for object permission

1👍

Django Rest API Guide says:

Also note that the generic views will only check the object-level permissions for views that retrieve a single model instance. If you require object-level filtering of list views, you’ll need to filter the queryset separately. See the filtering documentation for more details.

rest_framework.generics.BulkModelViewSet, as it’s name suggests,does bulk operations. It means that you have to use object-level filtering as proposed in the docs.

You should be looking especially under this section. Pay close attention to the example and make use of the code. You should also read about the DjangoModelPermissions to understand how does the example in the link above works.

Leave a comment