From 6cc67c4f831226929866e4a9c1b48ceb427386a5 Mon Sep 17 00:00:00 2001 From: James Turk Date: Tue, 7 Apr 2015 17:40:30 -0400 Subject: [PATCH] link to lift pages --- lifting/urls.py | 2 +- lifting/views.py | 4 ++-- templates/lifting/lift_list.html | 2 +- templates/lifting/month.html | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lifting/urls.py b/lifting/urls.py index 73f4685..90b62c2 100644 --- a/lifting/urls.py +++ b/lifting/urls.py @@ -8,7 +8,7 @@ urlpatterns = [ url(r'^(?P\d{4})/(?P\d{1,2})/(?P\d{1,2})/$', views.day_lifts, name='lifting-day'), url(r'^lifts/$', views.lift_list), - url(r'^lifts/(?P\d+)/$', views.by_lift), + url(r'^lifts/(?P\d+)/$', views.by_lift, name='lift-detail'), url(r'^fitnotes/$', views.fitnotes_upload), ] diff --git a/lifting/views.py b/lifting/views.py index f32ea02..e6da014 100644 --- a/lifting/views.py +++ b/lifting/views.py @@ -31,7 +31,7 @@ def month_lifts(request, year, month): # start calendar with a few blank days, then put days into array days = [None]*first_day for day in range(1, max_days+1): - days.append({'number': day, 'sets': sets_by_day[day]}) + days.append({'number': day, 'lifts': sets_by_day[day]}) # split days up into weeks days_by_week = [days[0:7], days[7:14], days[14:21], days[21:28], days[28:35], days[35:42]] @@ -71,7 +71,7 @@ def lift_list(request): lifts = Exercise.objects.filter(sets__user=request.user).annotate( total=Count('sets'), max_kg=Max('sets__weight_kg'), last_date=Max('sets__date'), - ) + ).order_by('-last_date') return render(request, 'lifting/lift_list.html', {'lifts': lifts}) diff --git a/templates/lifting/lift_list.html b/templates/lifting/lift_list.html index 5c56df6..12eef25 100644 --- a/templates/lifting/lift_list.html +++ b/templates/lifting/lift_list.html @@ -24,7 +24,7 @@ {% for lift in lifts %} - {{lift.display_name}} + {{lift.display_name}} {{lift.total}} {{lift.last_date}} {% mass_unit lift.max_kg %} {% mass_label %} diff --git a/templates/lifting/month.html b/templates/lifting/month.html index 50ba001..4330119 100644 --- a/templates/lifting/month.html +++ b/templates/lifting/month.html @@ -33,9 +33,9 @@ {{day.number}}
    - {% for set in day.sets %} + {% for lift in day.lifts %}
  • - {{set}} + {{lift.display_name}}
  • {% endfor %}