Ejemplo n.º 1
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)
Ejemplo n.º 2
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)
Ejemplo n.º 3
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)