From 5baa91df8229559e57186f54c63eae10a1d3fe2b Mon Sep 17 00:00:00 2001 From: Peter Stockings Date: Thu, 30 Mar 2023 20:42:14 +1100 Subject: [PATCH] Fix redirect to new workout page --- app.py | 4 ++-- templates/users.html | 2 +- templates/users_and_workouts_wrapper.html | 8 ++++++++ templates/workouts_list.html | 20 +++++++------------- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/app.py b/app.py index be6e1e7..ba7275e 100644 --- a/app.py +++ b/app.py @@ -255,8 +255,8 @@ def render_users_and_workouts(): users_data.append(user_data) if htmx: - render_template('users_and_workouts_wrapper.html', - users=users_data, bikes=Bike.query.all()) + return render_template('users_and_workouts_wrapper.html', + users=users_data, bikes=Bike.query.all()) return render_template('users_and_workouts.html', users=users_data, bikes=Bike.query.all()) diff --git a/templates/users.html b/templates/users.html index b0ade3c..627f5d8 100644 --- a/templates/users.html +++ b/templates/users.html @@ -1,7 +1,7 @@
-
+
+ type="submit" onclick="location.href = '{{ url_for('new_workout', user_id=u.id) }}';">New Workout
-
+
+ {% if u.workouts_count > 0 %} +

- - - - \ No newline at end of file + {% endif %} +
\ No newline at end of file