Add route to display selected workout for a person
This commit is contained in:
10
app.py
10
app.py
@@ -1,4 +1,4 @@
|
||||
from flask import Flask, render_template, g
|
||||
from flask import Flask, render_template, g, redirect, url_for
|
||||
import sqlite3
|
||||
|
||||
app = Flask(__name__)
|
||||
@@ -35,7 +35,13 @@ def display_workouts_for_person(person_id):
|
||||
|
||||
@app.route("/person/<int:person_id>/new_workout")
|
||||
def new_workout_for_person(person_id):
|
||||
return render_template('new_workout.html', name='peter')
|
||||
# hardcoded workout_id, need to create record in Workout table and return workout_id
|
||||
return redirect(url_for('show_workout_for_person', person_id=person_id, workout_id=1))
|
||||
|
||||
|
||||
@app.route("/person/<int:person_id>/workout/<int:workout_id>")
|
||||
def show_workout_for_person(person_id, workout_id):
|
||||
return render_template('workout.html', person_id=person_id, workout_id=workout_id)
|
||||
|
||||
|
||||
@app.teardown_appcontext
|
||||
|
||||
@@ -32,60 +32,48 @@
|
||||
class="px-4 bg-gray-50 text-gray-700 align-middle py-3 text-xs font-semibold text-left uppercase border-l-0 border-r-0 whitespace-nowrap">
|
||||
Top Set</th>
|
||||
<th
|
||||
class="px-4 bg-gray-50 text-gray-700 align-middle py-3 text-xs font-semibold text-left uppercase border-l-0 border-r-0 whitespace-nowrap min-w-140-px">
|
||||
class="px-4 bg-gray-50 text-gray-700 align-middle py-3 text-xs font-semibold text-left uppercase border-l-0 border-r-0 whitespace-nowrap min-w-140-px w-8">
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="divide-y divide-gray-100">
|
||||
<tr class="text-gray-500">
|
||||
<th class="border-t-0 px-4 align-middle text-sm font-normal whitespace-nowrap p-4 text-left">Squats
|
||||
<th class="border-t-0 px-4 align-middle text-l font-normal whitespace-nowrap p-4 text-left">Squats
|
||||
</th>
|
||||
<td class="border-t-0 px-4 align-middle text-xs font-medium text-gray-900 whitespace-nowrap p-4">
|
||||
<td class="border-t-0 px-4 align-middle text-l font-medium text-gray-900 whitespace-nowrap p-4">
|
||||
5 x 60kg</td>
|
||||
<td class="border-t-0 px-4 align-middle text-xs whitespace-nowrap p-4">
|
||||
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Edit
|
||||
</a>
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Delete
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="text-gray-500">
|
||||
<th class="border-t-0 px-4 align-middle text-sm font-normal whitespace-nowrap p-4 text-left">Squats
|
||||
<th class="border-t-0 px-4 align-middle text-l font-normal whitespace-nowrap p-4 text-left">Bench
|
||||
</th>
|
||||
<td class="border-t-0 px-4 align-middle text-xs font-medium text-gray-900 whitespace-nowrap p-4">
|
||||
<td class="border-t-0 px-4 align-middle text-l font-medium text-gray-900 whitespace-nowrap p-4">
|
||||
5 x 60kg</td>
|
||||
<td class="border-t-0 px-4 align-middle text-xs whitespace-nowrap p-4">
|
||||
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Edit
|
||||
</a>
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Delete
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="text-gray-500">
|
||||
<th class="border-t-0 px-4 align-middle text-sm font-normal whitespace-nowrap p-4 text-left">Squats
|
||||
<th class="border-t-0 px-4 align-middle text-l font-normal whitespace-nowrap p-4 text-left">Lat
|
||||
Pulldowns
|
||||
</th>
|
||||
<td class="border-t-0 px-4 align-middle text-xs font-medium text-gray-900 whitespace-nowrap p-4">
|
||||
5 x 60kg</td>
|
||||
<td class="border-t-0 px-4 align-middle text-xs whitespace-nowrap p-4">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="text-gray-500">
|
||||
<th class="border-t-0 px-4 align-middle text-sm font-normal whitespace-nowrap p-4 text-left">Squats
|
||||
</th>
|
||||
<td class="border-t-0 px-4 align-middle text-xs font-medium text-gray-900 whitespace-nowrap p-4">
|
||||
5 x 60kg</td>
|
||||
<td class="border-t-0 px-4 align-middle text-xs whitespace-nowrap p-4">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="text-gray-500">
|
||||
<th class="border-t-0 px-4 align-middle text-sm font-normal whitespace-nowrap p-4 text-left">Squats
|
||||
</th>
|
||||
<td class="border-t-0 px-4 align-middle text-xs font-medium text-gray-900 whitespace-nowrap p-4">
|
||||
5 x 60kg</td>
|
||||
<td class="border-t-0 px-4 align-middle text-xs whitespace-nowrap p-4">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="text-gray-500">
|
||||
<th class="border-t-0 px-4 align-middle text-sm font-normal whitespace-nowrap p-4 text-left">Squats
|
||||
</th>
|
||||
<td class="border-t-0 px-4 align-middle text-xs font-medium text-gray-900 whitespace-nowrap p-4">
|
||||
<td class="border-t-0 px-4 align-middle text-l font-medium text-gray-900 whitespace-nowrap p-4">
|
||||
5 x 60kg</td>
|
||||
<td class="border-t-0 px-4 align-middle text-xs whitespace-nowrap p-4">
|
||||
<a href="#"
|
||||
@@ -39,6 +39,9 @@
|
||||
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||
Lat Pulldown
|
||||
</th>
|
||||
<th scope="col"
|
||||
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider w-8">
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody class="bg-white">
|
||||
@@ -58,22 +61,15 @@
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-500">
|
||||
Apr 23 ,2021
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
5 x 60kg
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Edit
|
||||
</a>
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Delete
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -92,22 +88,15 @@
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-500">
|
||||
Apr 23 ,2021
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
5 x 60kg
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Edit
|
||||
</a>
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Delete
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@@ -126,6 +115,16 @@
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Edit
|
||||
</a>
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Delete
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-500">
|
||||
@@ -143,6 +142,16 @@
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Edit
|
||||
</a>
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Delete
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-500">
|
||||
@@ -160,6 +169,70 @@
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Edit
|
||||
</a>
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Delete
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-500">
|
||||
Apr 23 ,2021
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Edit
|
||||
</a>
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Delete
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-500">
|
||||
Apr 23 ,2021
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-normal text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
5 x 60kg
|
||||
</td>
|
||||
<td class="p-4 whitespace-nowrap text-sm font-semibold text-gray-900">
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Edit
|
||||
</a>
|
||||
<a href="#"
|
||||
class="text-sm font-medium text-cyan-600 hover:bg-gray-100 rounded-lg inline-flex items-center p-2">
|
||||
Delete
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user