aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--models.py10
1 files changed, 4 insertions, 6 deletions
diff --git a/models.py b/models.py
index 363cf33..56c1845 100644
--- a/models.py
+++ b/models.py
@@ -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),