From 436099ebef2acb8a3965cc39b07d99f61fa1eba2 Mon Sep 17 00:00:00 2001 From: Alban Gruin Date: Wed, 27 Sep 2017 15:06:54 +0200 Subject: Suppression des lignes trop longues --- views.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/views.py b/views.py index 442ada6..404b7cb 100644 --- a/views.py +++ b/views.py @@ -37,11 +37,15 @@ def group_list(request, year_slug, timetable_slug): year, week = get_current_week() start, _ = get_week(year, week) - groups_weeks = Course.objects.get_weeks(begin__gte=start, timetable=timetable).values("groups__mention", "groups__subgroup", "groups__td", "groups__tp", "year", "week") + groups_weeks = Course.objects.get_weeks(begin__gte=start, timetable=timetable) \ + .values("groups__mention", "groups__subgroup", + "groups__td", "groups__tp", "year", "week") for group in groups: for group_week in groups_weeks: - if group.corresponds_to(timetable.id, group_week["groups__mention"], group_week["groups__subgroup"], group_week["groups__td"], group_week["groups__tp"]): + if group.corresponds_to(timetable.id, group_week["groups__mention"], + group_week["groups__subgroup"], group_week["groups__td"], + group_week["groups__tp"]): if not hasattr(group, "weeks"): group.weeks = [] @@ -68,7 +72,8 @@ def timetable(request, year_slug, timetable_slug, group_slug, year=None, week=No timetable = get_object_or_404(Timetable, year__slug=year_slug, slug=timetable_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).annotate(Max("last_update")) + courses = Course.objects.get_courses_for_group(group, begin__gte=start, begin__lt=end) \ + .annotate(Max("last_update")) if courses.count() == 0: raise Http404 -- cgit v1.2.1