diff --git a/lifting/views.py b/lifting/views.py index e6da014..d2cfe2e 100644 --- a/lifting/views.py +++ b/lifting/views.py @@ -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): diff --git a/static/css/bia.css b/static/css/bia.css index d20f5ac..dbbf6e5 100644 --- a/static/css/bia.css +++ b/static/css/bia.css @@ -31,3 +31,8 @@ .month-day-list li { list-style: none; } +.a-row { +} +.b-row { + background-color: #cacaca; +} diff --git a/templates/lifting/by_lift.html b/templates/lifting/by_lift.html new file mode 100644 index 0000000..8b56ec6 --- /dev/null +++ b/templates/lifting/by_lift.html @@ -0,0 +1,45 @@ +{% extends "base.html" %} +{% load lifting %} + +{% block content %} + + + + {{lift.display_name}} + + + + + + + + + Date + Reps + Weight + + + {% regroup sets by date as set_list %} + + {% for set_day in set_list %} + {% cycle "a-row" "b-row" as rowclass silent %} + + + + {{set_day.grouper}} + + + + {% for set in set_day.list %} + + {{set.reps}} + {% mass_unit set.weight_kg %} {% mass_label %} + + {% endfor %} + {% endfor%} + + + + + +{% endblock %}