diff --git a/apps/permission/models.py b/apps/permission/models.py index 17214894..9c1b2e6c 100644 --- a/apps/permission/models.py +++ b/apps/permission/models.py @@ -45,6 +45,7 @@ class InstancedPermission: with transaction.atomic(): sid = transaction.savepoint() for o in self.model.model_class().objects.filter(pk=0).all(): + o._no_signal = True o._force_delete = True Model.delete(o) # An object with pk 0 wouldn't deleted. That's not normal, we alert admins. @@ -62,10 +63,6 @@ class InstancedPermission: obj._no_signal = True Model.save(obj, force_insert=True) ret = self.model.model_class().objects.filter(self.query & Q(pk=0)).exists() - # Delete testing object - obj._no_signal = True - obj._force_delete = True - Model.delete(obj) transaction.savepoint_rollback(sid) return ret