diff --git a/lifting/views.py b/lifting/views.py index b36a9fb..53cf5f7 100644 --- a/lifting/views.py +++ b/lifting/views.py @@ -17,9 +17,9 @@ from .models import Set def month(request, year, month): year, month = int(year), int(month) - sets_by_day = defaultdict(list) + sets_by_day = defaultdict(set) for workset in Set.objects.filter(user=request.user, date__year=year, date__month=month): - sets_by_day[workset.date.day].append(workset) + sets_by_day[workset.date.day].add(workset.exercise) date = datetime.date(year, month, 1) first_day, max_days = calendar.monthrange(year, month) # make first_day use 0 for sunday @@ -31,7 +31,7 @@ def month(request, year, month): for day in range(max_days+1): days.append({'number': day, 'sets': sets_by_day[day]}) - days_by_week = [days[0:7], days[7:14], days[14:21], days[21:28], days[28:35] + days_by_week = [days[0:7], days[7:14], days[14:21], days[21:28], days[28:35]] return render(request, 'month.html', { 'date': date, 'days': days_by_week diff --git a/static/css/bia.css b/static/css/bia.css new file mode 100644 index 0000000..150e249 --- /dev/null +++ b/static/css/bia.css @@ -0,0 +1,13 @@ +.calendar-month { + table-layout: fixed; +} +.calendar-month > tbody > tr > td { + border: 1px solid #666; + padding: 0 0 2em 0; +} +.day-number { + width: 100%; + text-align: right; + padding: 0 1em 0 0; + background-color: #ddd; +} diff --git a/templates/month.html b/templates/month.html index c7dfbbf..9734d22 100644 --- a/templates/month.html +++ b/templates/month.html @@ -9,7 +9,7 @@
- +
@@ -25,10 +25,16 @@ {% for week in days %} {% for day in week %} - {% endfor %}
Sunday
+ {% if day %} - {{day.number}} - {{day.sets|length}} +
{{day.number}}
+
    + {% for set in day.sets %} +
  • + {{set}} +
  • + {% endfor %} +
{% endif %}