def permissions_delete_override(permittee_kw, model_func, delete_perm):
    def delete(self, *args, **kwargs):
        """
        Override the default delete method to enforce permissions.
        """
        must_have_permission(permittee_kw, self, delete_perm)
        # delete all permissions for the object
        ObjectPermission.objects.filter_from_instance(self).delete()
        super(model_func(), self).delete(*args, **kwargs)
    return delete
Get a delete function that can be used to enforce
dataset/ETHPy150Open fp7-ofelia/ocf/expedient/src/python/expedient/common/permissions/utils.py/permissions_delete_override