From e04965c1f1e4116bc58841fcaf56ef89d231aff5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Ku=C5=BE=C3=ADlek?= Date: Sat, 14 Mar 2020 18:57:18 +0100 Subject: [PATCH] Fixed post/file deletus --- yadc/models.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/yadc/models.py b/yadc/models.py index f3af26e..77c41fc 100644 --- a/yadc/models.py +++ b/yadc/models.py @@ -243,7 +243,10 @@ class Post(TimestampMixin, db.Model): def remove_image_files(self): for im in self.image_files.values(): - os.remove(im) + try: + if im: os.remove(im) + except: + pass @property def image_files(self):