From 153dc0daef698fc1be471adaac3e9cd49949d4f5 Mon Sep 17 00:00:00 2001 From: winkidney Date: Thu, 21 Feb 2019 13:27:12 +0800 Subject: [PATCH] Fix: Should ignore error caused by pins which reference same image --- core/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/models.py b/core/models.py index 2b8ee09..9cd56d0 100644 --- a/core/models.py +++ b/core/models.py @@ -89,4 +89,7 @@ class Pin(models.Model): @receiver(models.signals.post_delete, sender=Pin) def delete_pin_images(sender, instance, **kwargs): - instance.image.delete() + try: + instance.image.delete() + except Image.DoesNotExist: + pass