[pricelist] Delete old images

This commit is contained in:
Ferdinand Thiessen 2021-11-19 13:32:54 +01:00
parent d00c603697
commit 795475fe15
1 changed files with 4 additions and 2 deletions

View File

@ -525,7 +525,7 @@ def delete_extra_ingredient(identifier):
def save_drink_picture(identifier, file):
drink = get_drink(identifier)
drink = delete_drink_picture(identifier)
drink.image_ = image_controller.upload_image(file)
db.session.commit()
return drink
@ -533,6 +533,8 @@ def save_drink_picture(identifier, file):
def delete_drink_picture(identifier):
drink = get_drink(identifier)
drink.image = None
if drink.image_:
db.session.delete(drink.image_)
drink.image_ = None
db.session.commit()
return drink