aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--models.py4
-rw-r--r--views.py6
2 files changed, 5 insertions, 5 deletions
diff --git a/models.py b/models.py
index 3b61fa8..3e8eae3 100644
--- a/models.py
+++ b/models.py
@@ -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):
diff --git a/views.py b/views.py
index 32a45fe..31a89f5 100644
--- a/views.py
+++ b/views.py
@@ -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 = []