1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2024-12-22 23:42:25 +00:00

🐛 Force delete didn't work as well when trying to check add permissions

This commit is contained in:
Yohann D'ANELLO 2020-07-30 13:10:03 +02:00
parent fb775de923
commit 0c0aed0234

View File

@ -44,7 +44,9 @@ class InstancedPermission:
else:
oldpk = obj.pk
# Ensure previous models are deleted
self.model.model_class().objects.filter(pk=obj.pk).annotate(_force_delete=F("pk")).delete()
for o in self.model.model_class().objects.filter(pk=obj.pk).all():
o._force_delete = True
Model.delete(o)
# Force insertion, no data verification, no trigger
obj._force_save = True
Model.save(obj, force_insert=True)