Skip to content
Snippets Groups Projects

Draft: Resolve "Add dialog with each lesson's students"

Merged Hangzhi Yu requested to merge 259-add-dialog-with-each-lesson-s-students into master
1 file
+ 10
1
Compare changes
  • Side-by-side
  • Inline
@@ -387,7 +387,16 @@ def is_documentation_teacher(user: User, obj: Documentation):
@@ -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.
Checks whether the person linked to the user is a teacher in the documentation.
"""
"""
if obj:
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
return False
Loading