From 63c960166d9172be2d92477aefefaab0fb319f7f Mon Sep 17 00:00:00 2001 From: Hangzhi Yu <hangzhi@protonmail.com> Date: Wed, 22 Jul 2020 23:00:30 +0200 Subject: [PATCH] Also check whether a person is a teacher in a LessonSubstitution in is_lesson_teacher --- aleksis/apps/alsijil/util/predicates.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/aleksis/apps/alsijil/util/predicates.py b/aleksis/apps/alsijil/util/predicates.py index 0aa9ebb63..3b747b695 100644 --- a/aleksis/apps/alsijil/util/predicates.py +++ b/aleksis/apps/alsijil/util/predicates.py @@ -14,10 +14,10 @@ def is_lesson_teacher(user: User, obj: LessonPeriod) -> bool: """Predicate for teachers of a lesson. Checks whether the person linked to the user is a teacher - in the lesson linked to the given LessonPeriod. + in the lesson or the substitution linked to the given LessonPeriod. """ if hasattr(obj, "lesson"): - return user.person in obj.lesson.teachers.all() + return user.person in obj.lesson.teachers.all() or user.person in obj.substitutions.teachers.all() return True -- GitLab