diff --git a/aleksis/apps/alsijil/util/predicates.py b/aleksis/apps/alsijil/util/predicates.py index 0aa9ebb631d0d1b8c1160723a1a764bb9526e7bc..3b747b695a3f6f0e290965c849c2544d9e38fd7a 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