Skip to content
Snippets Groups Projects
Verified Commit a07a82d0 authored by Nik | Klampfradler's avatar Nik | Klampfradler
Browse files

Merge branch 'master' of edugit.org:Teckids/BiscuIT/BiscuIT-App-Chronos

parents 6b8db972 e5365576
No related branches found
No related tags found
No related merge requests found
......@@ -13,7 +13,7 @@ class SelectForm(forms.Form):
label=_('Group'), required=False)
teacher = forms.ModelChoiceField(
queryset=Person.objects.annotate(lessons_count=Count(
'lessons')).filter(lessons_count__gt=0),
'lessons_as_teacher')).filter(lessons_count__gt=0),
label=_('Teacher'), required=False)
room = forms.ModelChoiceField(
queryset=Room.objects.annotate(lessons_count=Count(
......
from biscuit.core.models import Person
from .models import Lesson
from .models import Lesson, LessonPeriod
@Person.property
def lessons_as_participant(self):
return Lesson.objects.filter(groups__member=self)
return Lesson.objects.filter(groups__members=self)
@Person.property
def lesson_periods_as_participant(self):
return LessonPeriod.objects.filter(lesson__groups__members=self)
@Person.property
def lesson_periods_as_teacher(self):
return LessonPeriod.objects.filter(lesson__teachers=self)
......@@ -10,7 +10,7 @@ from django.db.models import Q
from django.http.request import QueryDict
from django.utils.translation import ugettext_lazy as _
from biscuit.core.mixins import SchoolRelated
from biscuit.core.mixins import ExtensibleModel, SchoolRelated
from biscuit.core.models import Group, Person
from .util import CalendarWeek, week_weekday_from_date
......@@ -274,7 +274,7 @@ class LessonSubstitution(SchoolRelated):
]
class LessonPeriod(SchoolRelated):
class LessonPeriod(SchoolRelated, ExtensibleModel):
objects = LessonPeriodManager.from_queryset(LessonPeriodQuerySet)()
lesson = models.ForeignKey('Lesson', models.CASCADE, related_name='lesson_periods')
......
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