From 1b2f90e250bcd732511f2f355296611549731e1f Mon Sep 17 00:00:00 2001 From: Dominik George <nik@naturalnet.de> Date: Mon, 11 Nov 2019 12:02:09 +0100 Subject: [PATCH] Document injected methods. --- biscuit/apps/chronos/model_extensions.py | 30 ++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/biscuit/apps/chronos/model_extensions.py b/biscuit/apps/chronos/model_extensions.py index b4a6d4ad..32055e65 100644 --- a/biscuit/apps/chronos/model_extensions.py +++ b/biscuit/apps/chronos/model_extensions.py @@ -5,14 +5,44 @@ from .models import Lesson, LessonPeriod @Person.property def lessons_as_participant(self): + """ Return a `QuerySet` containing all `Lesson`s this person + participates in (as student). + + .. note:: Only available when BiscuIT-App-Chronos is installed. + + :Date: 2019-11-07 + :Authors: + - Dominik George <dominik.george@teckids.org> + """ + return Lesson.objects.filter(groups__members=self) @Person.property def lesson_periods_as_participant(self): + """ Return a `QuerySet` containing all `LessonPeriod`s this person + participates in (as student). + + .. note:: Only available when BiscuIT-App-Chronos is installed. + + :Date: 2019-11-07 + :Authors: + - Dominik George <dominik.george@teckids.org> + """ + return LessonPeriod.objects.filter(lesson__groups__members=self) @Person.property def lesson_periods_as_teacher(self): + """ Return a `QuerySet` containing all `Lesson`s this person + gives (as teacher). + + .. note:: Only available when BiscuIT-App-Chronos is installed. + + :Date: 2019-11-07 + :Authors: + - Dominik George <dominik.george@teckids.org> + """ + return LessonPeriod.objects.filter(lesson__teachers=self) -- GitLab