aboutsummaryrefslogtreecommitdiff
path: root/views.py
diff options
context:
space:
mode:
authorAlban Gruin2017-01-22 12:22:14 +0100
committerAlban Gruin2017-01-22 12:22:14 +0100
commit9e8d4c492b0178214fb1997ff46335cfd4015557 (patch)
tree5b703ec4a712e3a19e0549354a017aa38b3258ff /views.py
parentdf2b69af6923aa9ef00e4e3070a28906b17593fc (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.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})