Skip to content
Snippets Groups Projects
Commit ce49fbab authored by Hangzhi Yu's avatar Hangzhi Yu
Browse files

Fix predicate

parent 286e031c
No related branches found
No related tags found
2 merge requests!352Draft: Resolve "Add dialog with each lesson's students",!350Resolve "Add simple course book list"
......@@ -387,7 +387,16 @@ def is_documentation_teacher(user: User, obj: Documentation):
Checks whether the person linked to the user is a teacher in the documentation.
"""
if obj:
return user.person in obj.teachers
if not str(obj.pk).startswith("DUMMY") and hasattr(obj, "teachers"):
teachers = obj.teachers
elif obj.lesson_event.amends:
if obj.lesson_event.teachers:
teachers = obj.lesson_event.teachers
else:
teachers = obj.lesson_event.amends.teachers
else:
teachers = obj.lesson_event.teachers
return user.person in teachers.all()
return False
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment