aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--models.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/models.py b/models.py
index c546737..c3118a3 100644
--- a/models.py
+++ b/models.py
@@ -71,7 +71,7 @@ class Timetable(SlugModel):
class GroupManager(Manager):
def get_parents(self, group):
- groups_criteria = Q(subgroup__isnull=True) | \
+ groups_criteria = Q(subgroup__isnull=True) | Q(subgroup__startswith=group.subgroup) | \
reduce(lambda x, y: x | y,
[Q(subgroup=group.subgroup[:i])
for i in range(1, len(group.subgroup) + 1)])
@@ -80,7 +80,7 @@ class GroupManager(Manager):
timetable=group.timetable)
def get_relevant_groups(self, timetable, *args, **criteria):
- sub = Group.objects.filter(timetable=timetable,mention=OuterRef("mention"),
+ sub = Group.objects.filter(timetable=timetable, mention=OuterRef("mention"),
subgroup__startswith=OuterRef("subgroup")) \
.order_by().values("mention").annotate(c=Count("*")).values("c")