miki725/django-rest-framework-bulk

Default allow_bulk_destroy implementation does the opposite of its documentation

softweave opened this issue · 1 comments

class FooView(BulkDestroyAPIView):
def allow_bulk_destroy(self, qs, filtered):
# custom logic here

    # default checks if the qs was filtered
    # qs comes from self.get_queryset()
    # filtered comes from self.filter_queryset(qs)
    return qs is not filtered

By default it checks if the queryset was filtered and if not will not allow the bulk delete to complete.

I understood this to mean bulk_destroy will only apply to filtered querysets. However, the default implementation returns true when the queryset is not filtered and false when it is.

Then BulkDestroyModelMixin logic only allows unfiltered querysets to be destroyed.

Is this correct and intentional?

After reading the source code, I realized this feature works as documented. My apologies.