link to lift pages

This commit is contained in:
James Turk 2015-04-07 17:40:30 -04:00
parent aa1e7efff9
commit 6cc67c4f83
4 changed files with 6 additions and 6 deletions

View File

@ -8,7 +8,7 @@ urlpatterns = [
url(r'^(?P<year>\d{4})/(?P<month>\d{1,2})/(?P<day>\d{1,2})/$', views.day_lifts,
name='lifting-day'),
url(r'^lifts/$', views.lift_list),
url(r'^lifts/(?P<lift_id>\d+)/$', views.by_lift),
url(r'^lifts/(?P<lift_id>\d+)/$', views.by_lift, name='lift-detail'),
url(r'^fitnotes/$', views.fitnotes_upload),
]

View File

@ -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})

View File

@ -24,7 +24,7 @@
<tbody>
{% for lift in lifts %}
<tr>
<td>{{lift.display_name}}</td>
<td><a href="{% url 'lift-detail' lift.id %}">{{lift.display_name}}</a></td>
<td>{{lift.total}}</td>
<td>{{lift.last_date}}</td>
<td>{% mass_unit lift.max_kg %} {% mass_label %}</td>

View File

@ -33,9 +33,9 @@
<a href="{% url 'lifting-day' date.year date.month day.number %}">{{day.number}}</a>
</div>
<ul class="month-day-list">
{% for set in day.sets %}
{% for lift in day.lifts %}
<li>
{{set}}
<a href="{% url 'lift-detail' lift.id %}">{{lift.display_name}}</a>
</li>
{% endfor %}
</ul>