Fix error in auto_delete_photo_on_change
This commit is contained in:
parent
27947907d5
commit
0a98e4a778
|
@ -96,7 +96,5 @@ def auto_delete_photo_on_change(sender, instance, **kwargs):
|
||||||
except Recette.DoesNotExist:
|
except Recette.DoesNotExist:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
new_file = instance.photo
|
if old_file and old_file != instance.photo and os.path.isfile(old_file.path):
|
||||||
if not old_file == new_file:
|
|
||||||
if os.path.isfile(old_file.path):
|
|
||||||
os.remove(old_file.path)
|
os.remove(old_file.path)
|
||||||
|
|
Loading…
Reference in a new issue