aboutsummaryrefslogtreecommitdiff
path: root/views.py
diff options
context:
space:
mode:
authorAlban Gruin2017-10-24 19:13:28 +0200
committerAlban Gruin2017-10-24 19:13:28 +0200
commit1edd7f6b2431095b27fd98205bb2ce5f462183e9 (patch)
treeb2fe976b0999dca2aa052e4deda171e826f96035 /views.py
parent3830f9c786f1a790d67958b0a6d38bea75679159 (diff)
parent07e9a1d1e6c77d64e5c3daf0324ae751117f168e (diff)
Merge branch 'fusion/alban'
Diffstat (limited to 'views.py')
-rw-r--r--views.py14
1 files changed, 8 insertions, 6 deletions
diff --git a/views.py b/views.py
index 2100972..9c38524 100644
--- a/views.py
+++ b/views.py
@@ -39,13 +39,12 @@ def group_list_common(request, timetable, groups):
groups_weeks = Course.objects.get_weeks(begin__gte=start, begin__lt=end, timetable=timetable) \
.values("groups__mention", "groups__subgroup",
- "groups__td", "groups__tp", "year", "week")
+ "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"]):
+ group_week["groups__subgroup"]):
if not hasattr(group, "weeks"):
group.weeks = []
@@ -60,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.get_relevant_groups(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):
@@ -78,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: