Ejemplo n.º 1
0
def add_menu():
    form = EditMenuForm()

    if form.validate_on_submit():
        the_menu = Menu()

        the_menu.name = form.name.data
        the_menu.created_on = datetime.utcnow()

        db.session.add(the_menu)
        flash("{0} has been created".format(the_menu.name))

        return redirect(url_for('.menus'))

    return render_template("admin/menus/new.html", js='menus/new', form=form)