diff options
-rw-r--r-- | models.py | 4 | ||||
-rw-r--r-- | views.py | 6 |
2 files changed, 5 insertions, 5 deletions
@@ -71,8 +71,8 @@ class LastUpdate(models.Model): class GroupManager(Manager): - def get_relevant_groups(self): - return self.get_queryset().annotate(children_count=Count("children")).filter(children_count=0) + def get_relevant_groups(self, *args, **filters): + return self.get_queryset().filter(*args, **filters).annotate(children_count=Count("children")).filter(children_count=0) class Group(models.Model): @@ -36,15 +36,15 @@ def mention_list(request, year_slug): def group_list(request, year_slug, timetable_slug): get_object_or_404(Year, slug=year_slug) timetable = get_object_or_404(Timetable, slug=timetable_slug) - groups = Group.objects.get_relevant_groups().order_by("name") + groups = Group.objects.get_relevant_groups(timetable=timetable).order_by("name") year, week = get_current_week() start, _ = get_week(year, week) - groups_weeks = Course.objects.get_weeks(begin__gte=start).values("group__timetable", "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(group_week["groups__timetable"], 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 = [] |