diff options
author | Alban Gruin | 2017-01-22 12:22:14 +0100 |
---|---|---|
committer | Alban Gruin | 2017-01-22 12:22:14 +0100 |
commit | 9e8d4c492b0178214fb1997ff46335cfd4015557 (patch) | |
tree | 5b703ec4a712e3a19e0549354a017aa38b3258ff /views.py | |
parent | df2b69af6923aa9ef00e4e3070a28906b17593fc (diff) |
Affichage des jours et des horaires sur la page des emplois du temps
Nouveau design inspiré par https://bestmotherfucking.website/
Utilisation des templates héritées
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}) |