Add page/route to display workouts for a selected person
This commit is contained in:
7
app.py
7
app.py
@@ -22,12 +22,17 @@ def query_db(query, args=(), one=False):
|
|||||||
|
|
||||||
|
|
||||||
@app.route("/")
|
@app.route("/")
|
||||||
def hello_world():
|
def home_page():
|
||||||
rows = query_db('select * from TopSet')
|
rows = query_db('select * from TopSet')
|
||||||
print(rows[0]['TopSetId'])
|
print(rows[0]['TopSetId'])
|
||||||
return render_template('index.html', name='peter')
|
return render_template('index.html', name='peter')
|
||||||
|
|
||||||
|
|
||||||
|
@app.route("/person/<int:person_id>")
|
||||||
|
def display_workouts_for_person(person_id):
|
||||||
|
return render_template('workouts.html', name='peter')
|
||||||
|
|
||||||
|
|
||||||
@app.teardown_appcontext
|
@app.teardown_appcontext
|
||||||
def close_connection(exception):
|
def close_connection(exception):
|
||||||
db = getattr(g, '_database', None)
|
db = getattr(g, '_database', None)
|
||||||
|
|||||||
172
templates/workouts.html
Normal file
172
templates/workouts.html
Normal file
@@ -0,0 +1,172 @@
|
|||||||
|
{% extends 'base.html' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
|
||||||
|
<div class="bg-white shadow rounded-lg p-4 sm:p-6 xl:p-8 ">
|
||||||
|
|
||||||
|
<div class="mb-4 flex items-center justify-between">
|
||||||
|
<div>
|
||||||
|
<h3 class="text-xl font-bold text-gray-900 mb-2">Gabe</h3>
|
||||||
|
<span class="text-base font-normal text-gray-500">List of workouts</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="flex flex-col mt-8">
|
||||||
|
<div class="overflow-x-auto rounded-lg">
|
||||||
|
<div class="align-middle inline-block min-w-full">
|
||||||
|
<div class="shadow overflow-hidden sm:rounded-lg">
|
||||||
|
<table class="min-w-full divide-y divide-gray-200">
|
||||||
|
<thead class="bg-gray-50">
|
||||||
|
<tr>
|
||||||
|
<th scope="col"
|
||||||
|
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||||
|
Date
|
||||||
|
</th>
|
||||||
|
<th scope="col"
|
||||||
|
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||||
|
Squats
|
||||||
|
</th>
|
||||||
|
|
||||||
|
<th scope="col"
|
||||||
|
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||||
|
Bench
|
||||||
|
</th>
|
||||||
|
<th scope="col"
|
||||||
|
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||||
|
Deadlift
|
||||||
|
</th>
|
||||||
|
<th scope="col"
|
||||||
|
class="p-4 text-left text-xs font-medium text-gray-500 uppercase tracking-wider">
|
||||||
|
Lat Pulldown
|
||||||
|
</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody class="bg-white">
|
||||||
|
<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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</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>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
Reference in New Issue
Block a user