Skip to content
Snippets Groups Projects
Commit 6e80016b authored by ynerant's avatar ynerant
Browse files

Don't delete object when checking an add permission: this is useless since we...

Don't delete object when checking an add permission: this is useless since we rollback to the initial DB state
parent 08e50ffc
No related branches found
No related tags found
1 merge request!138Permissions PC Kfet
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment