def deleteMenuItem(restaurant_id, menu_id): if request.method == 'POST': deleteMenuItemById(menu_id) flash ("Menu Item Deleted") return redirect(url_for('restaurantMenu', restaurant_id = restaurant_id)) else: item = getMenuItemById(menu_id) return render_template('deletemenuitem.html', restaurant_id = restaurant_id, menu_id = menu_id, item = item)
def editMenuItem(restaurant_id, menu_id): editedItem = getMenuItemById(menu_id) if request.method == 'POST': if (request.form['name']): editedItem.name = request.form['name'] addMenuItem(editedItem) flash ("Menu Item Edited") return redirect(url_for('restaurantMenu', restaurant_id = restaurant_id)) else: return render_template('editmenuitem.html', restaurant_id = restaurant_id, menu_id = menu_id, i = editedItem)