diff options
| author | stilbruch <stilbruch@protonail.com> | 2022-05-02 17:43:02 -0500 |
|---|---|---|
| committer | stilbruch <stilbruch@protonail.com> | 2022-05-02 17:43:02 -0500 |
| commit | 116a7a47023ce18f7a54729f7da77eff674f8c0c (patch) | |
| tree | 51467d341c5b5ec1ca18df881d33b38e397d7fb3 /app/routes/workout.py | |
| parent | 3f4d0f78751b15de1e4c3c9988df4443f5a71a9c (diff) | |
| download | Strengthy-116a7a47023ce18f7a54729f7da77eff674f8c0c.tar.xz Strengthy-116a7a47023ce18f7a54729f7da77eff674f8c0c.zip | |
Change workout/edit to parameterized route
Diffstat (limited to 'app/routes/workout.py')
| -rw-r--r-- | app/routes/workout.py | 10 |
1 files changed, 3 insertions, 7 deletions
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/<workout_id>", 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")) |
