Skip to content
Snippets Groups Projects
Commit 912f3cca authored by Alban Gruin's avatar Alban Gruin
Browse files

get_parents() sélectionne aussi les groupes enfants dont le

sous-groupe commence par la même chaîne que celui du groupe passé en
paramètre.
Correction cosmétique du code.
parent bafa5f07
Branches
Tags
No related merge requests found
......@@ -71,7 +71,7 @@ class Meta:
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 @@ def get_parents(self, group):
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")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment