diff --git a/aleksis/apps/chronos/model_extensions.py b/aleksis/apps/chronos/model_extensions.py index 1d93db9aa30cb4436ede00bc67eadc962bdab59f..62570c636dd15165919abc0c12815478836cc809 100644 --- a/aleksis/apps/chronos/model_extensions.py +++ b/aleksis/apps/chronos/model_extensions.py @@ -3,6 +3,13 @@ from aleksis.core.models import Person from .models import Lesson, LessonPeriod +@Person.property +def is_teacher(self): + """ Check if the user has lessons as an teacher """ + + return Lesson.objects.filter(teachers=self).exists() + + @Person.property def lessons_as_participant(self): """ Return a `QuerySet` containing all `Lesson`s this person