示例#1
0
def print_menu():
    menudb = Menudb()
    menuName = request.form['inputMenuName']
    getDishes = menudb.searchMenu(menuName)
    return render_template('print_menu.html',
                           menuName=menuName,
                           dishes=getDishes)
示例#2
0
def menuEdit():
    form = addMenuForm()
    menudb = Menudb()
    menuName = request.form['menuEdit']
    getDishes = menudb.searchMenu(menuName)
    items = menudb.getItems()
    return render_template('add_lists.html',
                           form=form,
                           items=items,
                           getDishes=getDishes,
                           menuName=menuName)
示例#3
0
def menu_dishes():
    form = addDishForm()
    menudb = Menudb()
    items = menudb.getItems()
    if form.validate_on_submit():
        dishAdd_msg = menudb.addItem(form.dish.data, form.name.data,
                                     form.price.data)
        if dishAdd_msg == "DishAddSucess":
            return redirect('menu_dishes')
        else:
            dishAdd_msg = dishAdd_msg
            return render_template('menu_dishes.html',
                                   form=form,
                                   items=items,
                                   error=form.errors,
                                   dishAdd_msg=dishAdd_msg)
    return render_template('menu_dishes.html',
                           form=form,
                           items=items,
                           error=form.errors)
示例#4
0
def add_lists():
    form = addMenuForm()
    menudb = Menudb()
    items = menudb.getItems()
    if form.validate_on_submit():
        menuAdd_msg = menudb.addMenu(form.giveMenuname.data,
                                     request.form.getlist('dish'),
                                     request.form.getlist('name'),
                                     request.form.getlist('price'))
        if menuAdd_msg == "MenuAddSucess":
            return redirect('menu_lists')
        else:
            menuAdd_msg = menuAdd_msg
            return render_template('add_lists.html',
                                   form=form,
                                   items=items,
                                   error=form.errors,
                                   menuAdd_msg=menuAdd_msg)
    return render_template('add_lists.html',
                           form=form,
                           items=items,
                           error=form.errors)
示例#5
0
def menu_lists():
    menudb = Menudb()
    menu_names = menudb.getMenusNames()[0]
    menu_dishes = menudb.getMenusNames()[1]
    return render_template('menu_lists.html', menu_names=menu_names)
示例#6
0
def menuDel():
    menudb = Menudb()
    menuName = request.form['menuDel']
    menudb.menuDel(menuName)
    return redirect('menu_lists')
示例#7
0
def delDish():
    menudb = Menudb()
    dishName = request.form['delDish']
    menudb.delDish(dishName)
    return redirect('menu_dishes')
示例#8
0
def dbUpdate():
    menudb = Menudb()
    menudb.dbUpdate(request.form['menuname'], request.form.getlist('dish'),
                    request.form.getlist('name'),
                    request.form.getlist('price'))
    return redirect('menu_lists')