🐛 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
1 changed files with 3 additions and 1 deletions

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)