diff options
author | Alban Gruin | 2018-01-18 13:35:29 +0100 |
---|---|---|
committer | Alban Gruin | 2018-01-18 13:35:29 +0100 |
commit | bc7cac9459ac3ae55a31e9dd215cfc8f054e5fb1 (patch) | |
tree | f11124364c2bfea7187b4033c364b627512ddce0 | |
parent | 3a5e355f92881597c22a434ea300175a624586ea (diff) |
get_courses() émet une exception si l’objet passé n’est ni un groupe
ni une salle
-rw-r--r-- | models.py | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -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") |