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")
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")
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")
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")