def destroy(self, request, *args, **kwargs):
        """Destroy a model instance.

        If ``delete_content`` flag is set in query parameters, also all
        Data objects and Entities, on which user has ``EDIT``
        permission, contained in collection will be deleted.
        """
        obj = self.get_object()
        user = request.user

        if strtobool(request.query_params.get('delete_content', 'false')):
            for entity in obj.entity_set.all():
                if user.has_perm('edit_entity', entity):
                    entity.delete()

            for data in obj.data.all():
                if user.has_perm('edit_data', data):
                    data.delete()

        return super().destroy(request, *args, **kwargs)
def destroy ( self , request , * args , ** kwargs ) : obj = self . get_object ( ) user = request . user if strtobool ( request . query_params . get ( 'delete_content' , 'false' ) ) : for entity in obj . entity_set . all ( ) : if user . has_perm ( 'edit_entity' , entity ) : entity . delete ( ) for data in obj . data . all ( ) : if user . has_perm ( 'edit_data' , data ) : data . delete ( ) return super ( ) . destroy ( request , * args , ** kwargs )
Destroy a model instance.

        If ``delete_content`` flag is set in query parameters, also all
        Data objects and Entities, on which user has ``EDIT``
        permission, contained in collection will be deleted.