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

Add missing imports

parent a070ee6f
No related branches found
No related tags found
No related merge requests found
from datetime import date, timedelta, datetime
from typing import Union, Optional, OrderedDict
from aleksis.apps.chronos.util.date import week_weekday_from_date
from calendarweek import CalendarWeek
from django.db import models
from django.db.models import F, Q, Count
from django.http import QueryDict
from aleksis.core.models import Person, Group
class LessonPeriodManager(models.Manager): class LessonPeriodManager(models.Manager):
""" Manager adding specific methods to lesson periods. """ """ Manager adding specific methods to lesson periods. """
...@@ -117,7 +129,7 @@ class LessonDataQuerySet(models.QuerySet): ...@@ -117,7 +129,7 @@ class LessonDataQuerySet(models.QuerySet):
return qs1.union(qs2) return qs1.union(qs2)
def filter_room(self, room: Union[Room, int]): def filter_room(self, room: Union["Room", int]):
""" Filter for all lessons taking part in a certain room. """ """ Filter for all lessons taking part in a certain room. """
qs1 = self.filter(**{self._period_path + "room": room}) qs1 = self.filter(**{self._period_path + "room": room})
...@@ -159,7 +171,7 @@ class LessonPeriodQuerySet(LessonDataQuerySet): ...@@ -159,7 +171,7 @@ class LessonPeriodQuerySet(LessonDataQuerySet):
_period_path = "" _period_path = ""
_subst_path = "substitutions__" _subst_path = "substitutions__"
def next(self, reference: LessonPeriod, offset: Optional[int] = 1) -> LessonPeriod: def next(self, reference: "LessonPeriod", offset: Optional[int] = 1) -> "LessonPeriod":
""" Get another lesson in an ordered set of lessons. """ Get another lesson in an ordered set of lessons.
By default, it returns the next lesson in the set. By passing the offset argument, By default, it returns the next lesson in the set. By passing the offset argument,
...@@ -246,6 +258,7 @@ class LessonSubstitutionQuerySet(LessonDataQuerySet): ...@@ -246,6 +258,7 @@ class LessonSubstitutionQuerySet(LessonDataQuerySet):
def affected_lessons(self): def affected_lessons(self):
""" Return all lessons which are affected by selected substitutions """ """ Return all lessons which are affected by selected substitutions """
from .models import Lesson # noaq
return Lesson.objects.filter(lesson_periods__substitutions__in=self) return Lesson.objects.filter(lesson_periods__substitutions__in=self)
......
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