Force delete some objects

This commit is contained in:
Yohann D'ANELLO 2020-07-30 14:58:18 +02:00
parent 0c0aed0234
commit e63219f7ad
1 changed files with 2 additions and 1 deletions

View File

@ -85,7 +85,8 @@ def pre_delete_object(instance, **kwargs):
if instance._meta.label_lower in EXCLUDED:
return
if hasattr(instance, "_force_delete"):
if hasattr(instance, "_force_delete") or hasattr(instance, "pk") and instance.pk == 0:
# Don't check permissions on force-deleted objects
return
user = get_current_authenticated_user()