示例#1
0
def updateRecipe(id):
    data = {
        "id": id,
        "name": request.form['name'],
        "filling": request.form['filling'],
        "crust": request.form['crust'],
    }
    if not Pie.validate_pie(data):
        return redirect(f"/edit/{data['id']}")
    Pie.updatePie(data)
    return redirect("/dashboard")
示例#2
0
def create():
    data = {
        "name": request.form['name'],
        "user_id": session['user_id'],
        "filling": request.form['filling'],
        "crust": request.form['crust'],
        "vote": 0
    }
    if not Pie.validate_pie(data):
        return redirect("/dashboard")
    res = Pie.create(data)
    print(res)
    return redirect("/dashboard")
示例#3
0
def update_pie(id):

    if not Pie.validate_pie(request.form):
        return redirect(f"/edit/{id}")

    data = {
        "id" : id,
        "pie_name" : request.form['pie_name'],
        "filling" : request.form['filling'],
        "crust" : request.form['crust'],
    }

    Pie.update_pie_info(data)
    return redirect("/dashboard")
示例#4
0
def add_pie_to_db():
    if not Pie.validate_pie(request.form):
        return redirect("/dashboard")


    data = {
        "pie_name" : request.form['pie_name'],
        "filling" : request.form['filling'],
        "crust" : request.form['crust'],
        "user_id" : session["user_id"]
    }

    Pie.save_pie(data)
    return redirect("/dashboard")