aboutsummaryrefslogtreecommitdiff
path: root/views.py
diff options
context:
space:
mode:
authorAlban Gruin2017-10-20 13:29:07 +0200
committerAlban Gruin2017-10-22 13:16:02 +0200
commitb7773b892ee68209feb33870496985f78243681a (patch)
treeb2fe976b0999dca2aa052e4deda171e826f96035 /views.py
parent86efcdcd2df04a59eb5f27212d8d41f60f861f6c (diff)
Modification de la requĂȘte qui sĂ©lectionne les groupes pertinents.
Diffstat (limited to 'views.py')
-rw-r--r--views.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/views.py b/views.py
index e5c89a2..9c38524 100644
--- a/views.py
+++ b/views.py
@@ -59,7 +59,7 @@ def group_list_common(request, timetable, groups):
def group_list(request, year_slug, timetable_slug):
timetable = get_object_or_404(Timetable, year__slug=year_slug, slug=timetable_slug)
- groups = Group.objects.filter(timetable=timetable).order_by("name")
+ groups = Group.objects.get_relevant_groups(timetable)
return group_list_common(request, timetable, groups)
def timetable(request, year_slug, timetable_slug, group_slug, year=None, week=None):
@@ -77,8 +77,11 @@ 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)
- # if group.children.count():
- # return group_list_common(request, timetable, Group.objects.get_relevant_children(group))
+ if Group.objects.filter(timetable=timetable, mention=group.mention,
+ subgroup__startswith=group.subgroup).count() > 1:
+ subgroups = Group.objects.get_relevant_groups(timetable, mention=group.mention,
+ subgroup__startswith=group.subgroup)
+ return group_list_common(request, timetable, subgroups)
courses = Course.objects.get_courses_for_group(group, begin__gte=start, begin__lt=end)
if courses.count() == 0 and provided_week: