diff options
Diffstat (limited to 'models.py')
-rw-r--r-- | models.py | 10 |
1 files changed, 4 insertions, 6 deletions
@@ -93,12 +93,10 @@ class Timetable(SlugModel): class GroupManager(Manager): def get_parents(self, group): - groups_criteria = Q(subgroup="") - - if len(group.subgroup) != 0: - groups_criteria |= reduce(lambda x, y: x | y, - [Q(subgroup=group.subgroup[:i]) - for i in range(1, len(group.subgroup) + 1)]) + groups_criteria = reduce(lambda x, y: x | y, + [Q(subgroup=group.subgroup[:i]) + for i in range(1, len(group.subgroup) + 1)], + Q(subgroup="")) return self.get_queryset().filter(groups_criteria, Q(semester=None) | Q(semester=group.semester), |