aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--models.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/models.py b/models.py
index 4903b11..ae04fb8 100644
--- a/models.py
+++ b/models.py
@@ -178,7 +178,8 @@ class CourseManager(Manager):
qs = qs.filter(groups__in=Group.objects.get_parents(obj), **criteria) \
.prefetch_related("rooms")
elif isinstance(obj, Room):
- qs = qs.filter(rooms__in=(obj,), **criteria)
+ qs = qs.filter(rooms__in=(obj,), **criteria) \
+ .prefetch_related("groups", "rooms")
else:
raise(TypeError, "obj must be a Group or a Room")