Commit b7f0c94f authored by Willard's avatar Willard

Fix image input not having the right path on edit

parent 158feeaa
......@@ -162,8 +162,9 @@ def edit_dish(stall_id, dish_id):
dish.name = form.name.data
dish.description = form.description.data
dish.price = form.price.data
dish.image_path = secure_filename(form.image.data.filename)
form.image.data.save(os.path.join(app.config['UPLOAD_FOLDER'], dish.image_path))
if form.image.data.filename is not u'':
dish.image_path = secure_filename(form.image.data.filename)
form.image.data.save(os.path.join(app.config['UPLOAD_FOLDER'], dish.image_path))
db.session.commit()
return redirect(url_for('stall', stall_id=stall_id))
else:
......
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