by_lift
This commit is contained in:
parent
7fadd388b1
commit
15546fb07a
@ -77,7 +77,9 @@ def lift_list(request):
|
||||
|
||||
@login_required
|
||||
def by_lift(request, lift_id):
|
||||
pass
|
||||
lift = Exercise.objects.get(pk=lift_id)
|
||||
sets = Set.objects.filter(user=request.user, exercise=lift).order_by('-date')
|
||||
return render(request, 'lifting/by_lift.html', {'lift': lift, 'sets': sets})
|
||||
|
||||
|
||||
class FitnotesUploadForm(forms.Form):
|
||||
|
@ -31,3 +31,8 @@
|
||||
.month-day-list li {
|
||||
list-style: none;
|
||||
}
|
||||
.a-row {
|
||||
}
|
||||
.b-row {
|
||||
background-color: #cacaca;
|
||||
}
|
||||
|
45
templates/lifting/by_lift.html
Normal file
45
templates/lifting/by_lift.html
Normal file
@ -0,0 +1,45 @@
|
||||
{% extends "base.html" %}
|
||||
{% load lifting %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
<section class="row header-row">
|
||||
<section class="col-sm-12">
|
||||
<h3>{{lift.display_name}}</h3>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
<section class="row">
|
||||
<section class="col-sm-12">
|
||||
<table class="table lifts-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Reps</th>
|
||||
<th>Weight</th>
|
||||
</tr>
|
||||
</thead>
|
||||
{% regroup sets by date as set_list %}
|
||||
<tbody>
|
||||
{% for set_day in set_list %}
|
||||
{% cycle "a-row" "b-row" as rowclass silent %}
|
||||
<tr class="{{rowclass}}">
|
||||
<td rowspan="{{set_day.list|length|add:"1"}}">
|
||||
<a href="{% url 'lifting-day' set_day.grouper.year set_day.grouper.month set_day.grouper.day %}">
|
||||
{{set_day.grouper}}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% for set in set_day.list %}
|
||||
<tr class="{{rowclass}}">
|
||||
<td>{{set.reps}}</td>
|
||||
<td>{% mass_unit set.weight_kg %} {% mass_label %}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
{% endfor%}
|
||||
</tbody>
|
||||
</table>
|
||||
</section>
|
||||
</section>
|
||||
|
||||
{% endblock %}
|
Loading…
Reference in New Issue
Block a user