Commit b7f0c94f authored by Willard's avatar Willard

Fix image input not having the right path on edit

parent 158feeaa
...@@ -162,6 +162,7 @@ def edit_dish(stall_id, dish_id): ...@@ -162,6 +162,7 @@ def edit_dish(stall_id, dish_id):
dish.name = form.name.data dish.name = form.name.data
dish.description = form.description.data dish.description = form.description.data
dish.price = form.price.data dish.price = form.price.data
if form.image.data.filename is not u'':
dish.image_path = secure_filename(form.image.data.filename) dish.image_path = secure_filename(form.image.data.filename)
form.image.data.save(os.path.join(app.config['UPLOAD_FOLDER'], dish.image_path)) form.image.data.save(os.path.join(app.config['UPLOAD_FOLDER'], dish.image_path))
db.session.commit() db.session.commit()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment