diff --git a/aleksis/apps/kolego/managers.py b/aleksis/apps/kolego/managers.py index 9b86575989833bd1494500c72d2eaa5bc03bd598..de994121b864166a4e6bc07aa657e9ad2a38ba42 100644 --- a/aleksis/apps/kolego/managers.py +++ b/aleksis/apps/kolego/managers.py @@ -1,10 +1,8 @@ -from polymorphic.managers import PolymorphicQuerySet - -from aleksis.core.managers import DateRangeQuerySetMixin +from aleksis.core.managers import DateRangeQuerySetMixin, RecurrencePolymorphicQuerySet from aleksis.core.models import Person -class AbsenceQuerySet(DateRangeQuerySetMixin, PolymorphicQuerySet): +class AbsenceQuerySet(DateRangeQuerySetMixin, RecurrencePolymorphicQuerySet): """QuerySet with custom query methods for absences.""" def absent_persons(self): diff --git a/aleksis/apps/kolego/models/absence.py b/aleksis/apps/kolego/models/absence.py index c59a3383b085b00d8e4c56eef099d6761cde859a..47557983137c929af2d82003586aa3d43227adbd 100644 --- a/aleksis/apps/kolego/models/absence.py +++ b/aleksis/apps/kolego/models/absence.py @@ -5,7 +5,9 @@ from django.utils.translation import gettext_lazy as _ from colorfield.fields import ColorField -from aleksis.core.managers import PolymorphicBaseManager +from aleksis.core.managers import ( + RecurrencePolymorphicManager, +) from aleksis.core.mixins import ExtensibleModel from aleksis.core.models import FreeBusy @@ -69,7 +71,7 @@ class AbsenceReason(ExtensibleModel): class Absence(FreeBusy): - objects = PolymorphicBaseManager.from_queryset(AbsenceQuerySet)() + objects = RecurrencePolymorphicManager.from_queryset(AbsenceQuerySet)() reason = models.ForeignKey( "AbsenceReason", @@ -89,9 +91,9 @@ class Absence(FreeBusy): @classmethod def get_objects( - cls, request: HttpRequest | None = None, params: dict[str, any] | None = None + cls, request: HttpRequest | None = None, params: dict[str, any] | None = None, **kwargs ) -> QuerySet: - qs = super().get_objects(request, params).select_related("person", "reason") + qs = super().get_objects(request, params, **kwargs).select_related("person", "reason") if params: if params.get("person"): qs = qs.filter(person_id=params["person"])