[pricelist] Delete old images
This commit is contained in:
parent
d00c603697
commit
795475fe15
|
@ -525,7 +525,7 @@ def delete_extra_ingredient(identifier):
|
||||||
|
|
||||||
|
|
||||||
def save_drink_picture(identifier, file):
|
def save_drink_picture(identifier, file):
|
||||||
drink = get_drink(identifier)
|
drink = delete_drink_picture(identifier)
|
||||||
drink.image_ = image_controller.upload_image(file)
|
drink.image_ = image_controller.upload_image(file)
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return drink
|
return drink
|
||||||
|
@ -533,6 +533,8 @@ def save_drink_picture(identifier, file):
|
||||||
|
|
||||||
def delete_drink_picture(identifier):
|
def delete_drink_picture(identifier):
|
||||||
drink = get_drink(identifier)
|
drink = get_drink(identifier)
|
||||||
drink.image = None
|
if drink.image_:
|
||||||
|
db.session.delete(drink.image_)
|
||||||
|
drink.image_ = None
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
return drink
|
return drink
|
||||||
|
|
Loading…
Reference in New Issue