diff options
Diffstat (limited to 'views.py')
-rw-r--r-- | views.py | 9 |
1 files changed, 8 insertions, 1 deletions
@@ -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}) |