From 2d93f18514abaa194b70012b2e01bd80eead1bef Mon Sep 17 00:00:00 2001
From: Hangzhi Yu <hangzhi@protonmail.com>
Date: Thu, 20 Jun 2024 18:29:22 +0200
Subject: [PATCH] Only consider LessonEvent objects when searching for existing
 substitutions

---
 aleksis/apps/chronos/models.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/aleksis/apps/chronos/models.py b/aleksis/apps/chronos/models.py
index 7f4b3595..8cb324f5 100644
--- a/aleksis/apps/chronos/models.py
+++ b/aleksis/apps/chronos/models.py
@@ -1640,7 +1640,7 @@ class LessonEvent(CalendarEvent):
             )
 
             if affected_teachers.exists():
-                existing_substitutions = reference_obj.amended_by.filter(
+                existing_substitutions = reference_obj.amended_by.instance_of(cls).filter(
                     datetime_start=event["DTSTART"].dt,
                     datetime_end=event["DTEND"].dt,
                 )
-- 
GitLab