image upload working
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user