Private
Public Access
1
0

image upload working

This commit is contained in:
Sander Roosendaal
2018-01-23 14:37:52 +01:00
parent 983b3be86c
commit 22cba46f3b
6 changed files with 395 additions and 9 deletions

View File

@@ -858,7 +858,9 @@ class GraphImage(models.Model):
def auto_delete_image_on_delete(sender,instance, **kwargs):
if instance.filename:
if os.path.isfile(instance.filename):
os.remove(instance.filename)
others = GraphImage.objects.filter(filename=instance.filename)
if len(others) == 0:
os.remove(instance.filename)
else:
print "couldn't find the file "+instance.filename