aboutsummaryrefslogtreecommitdiff
path: root/views.py
diff options
context:
space:
mode:
Diffstat (limited to 'views.py')
-rw-r--r--views.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/views.py b/views.py
index 99255c7..b971dc5 100644
--- a/views.py
+++ b/views.py
@@ -30,4 +30,11 @@ def timetable(request, timetable_slug, year, week, group_slug):
group = get_object_or_404(Group, slug=group_slug, timetable=timetable)
courses = Course.objects.get_courses_for_group(group, begin__gte=start, begin__lt=end)
- return render_to_response("timetable.html", {"timetable": timetable, "group": group, "courses": courses})
+ grouped_courses = []
+ for i, course in enumerate(courses):
+ if i == 0 or courses[i - 1].begin.day != course.begin.day:
+ grouped_courses.append([course])
+ else:
+ grouped_courses[-1].append(course)
+
+ return render_to_response("timetable.html", {"timetable": timetable, "group": group, "courses": grouped_courses, "week": week})