Skip to content
Snippets Groups Projects
Verified Commit ad0713b1 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Add model extension to Person for check if the person is a teacher

parent 6772fe18
1 merge request!31Biscuit merge. Closes #53.
......@@ -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
......
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