aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlban Gruin2018-01-18 13:35:29 +0100
committerAlban Gruin2018-01-18 13:35:29 +0100
commitbc7cac9459ac3ae55a31e9dd215cfc8f054e5fb1 (patch)
treef11124364c2bfea7187b4033c364b627512ddce0
parent3a5e355f92881597c22a434ea300175a624586ea (diff)
get_courses() émet une exception si l’objet passé n’est ni un groupe
ni une salle
-rw-r--r--models.py2
1 files changed, 2 insertions, 0 deletions
diff --git a/models.py b/models.py
index 56c1845..5de1df2 100644
--- a/models.py
+++ b/models.py
@@ -179,6 +179,8 @@ class CourseManager(Manager):
.prefetch_related("rooms")
elif isinstance(obj, Room):
qs = qs.filter(rooms__in=(obj,), **criteria)
+ else:
+ raise(TypeError, "obj must be a Group or a Room")
return qs.order_by("begin")