diff options
Diffstat (limited to 'models.py')
-rw-r--r-- | models.py | 9 |
1 files changed, 5 insertions, 4 deletions
@@ -195,11 +195,12 @@ class CourseManager(Manager): def get_courses(self, obj, **criteria): qs = self.get_queryset() if isinstance(obj, Group): - qs = qs.filter(groups__in=Group.objects.get_parents(obj), - **criteria).prefetch_related("rooms") + qs = qs.filter( + groups__in=Group.objects.get_parents(obj), **criteria) \ + .prefetch_related("rooms") elif isinstance(obj, Room): - qs = qs.filter(rooms=obj, **criteria).prefetch_related("rooms", - "groups") + qs = qs.filter(rooms=obj, **criteria) \ + .prefetch_related("rooms", "groups") else: raise(TypeError, "obj must be a Group or a Room") |