From 116a7a47023ce18f7a54729f7da77eff674f8c0c Mon Sep 17 00:00:00 2001 From: stilbruch Date: Mon, 2 May 2022 17:43:02 -0500 Subject: Change workout/edit to parameterized route --- app/routes/workout.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'app/routes/workout.py') diff --git a/app/routes/workout.py b/app/routes/workout.py index de2fe51..5eb18d9 100644 --- a/app/routes/workout.py +++ b/app/routes/workout.py @@ -32,16 +32,12 @@ def workout_create(): return render_template("workout/create.html", form=form) -@app.route("/workout/edit", methods=["GET", "POST"]) +@app.route("/workout/edit/", methods=["GET", "POST"]) @login_required -def workout_edit(): - # Id is required - if "id" not in request.args: - return redirect(url_for("home")) - +def workout_edit(workout_id=None): # Validate Id workout = Workout.query.filter_by( - id=int(request.args["id"]), user_id=current_user.id + id=int(workout_id), user_id=current_user.id ).first() if not workout: return redirect(url_for("home")) -- cgit v1.2.3