This commit is contained in:
James Turk 2015-04-08 11:17:37 -04:00
parent 7fadd388b1
commit 15546fb07a
3 changed files with 53 additions and 1 deletions

View File

@ -77,7 +77,9 @@ def lift_list(request):
@login_required @login_required
def by_lift(request, lift_id): 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): class FitnotesUploadForm(forms.Form):

View File

@ -31,3 +31,8 @@
.month-day-list li { .month-day-list li {
list-style: none; list-style: none;
} }
.a-row {
}
.b-row {
background-color: #cacaca;
}

View 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 %}