From 2d153af2bce16dfa1c7f24b5b29b89e7deee249a Mon Sep 17 00:00:00 2001
From: magicfelix <felix@felix-zauberer.de>
Date: Thu, 18 Apr 2024 18:04:41 +0200
Subject: [PATCH] Fix field references

---
 aleksis/apps/alsijil/models.py               | 4 ++--
 aleksis/apps/alsijil/schema/documentation.py | 2 ++
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/aleksis/apps/alsijil/models.py b/aleksis/apps/alsijil/models.py
index ccf3f1617..332c428fa 100644
--- a/aleksis/apps/alsijil/models.py
+++ b/aleksis/apps/alsijil/models.py
@@ -558,7 +558,7 @@ class Documentation(CalendarEvent):
                 continue
 
             event_reference_obj = event["REFERENCE_OBJECT"]
-            existing_documentations = event_reference_obj.documentation.filter(
+            existing_documentations = event_reference_obj.amended_by.filter(
                 datetime_start=event["DTSTART"].dt,
                 datetime_end=event["DTEND"].dt,
             )
@@ -635,7 +635,7 @@ class ParticipationStatus(CalendarEvent):
     )
 
     def __str__(self) -> str:
-        return f"{self.documentation}, {self.person}"
+        return f"{self.related_documentation}, {self.person}"
 
     class Meta:
         verbose_name = _("Participation Status")
diff --git a/aleksis/apps/alsijil/schema/documentation.py b/aleksis/apps/alsijil/schema/documentation.py
index c458ec135..3225db34e 100644
--- a/aleksis/apps/alsijil/schema/documentation.py
+++ b/aleksis/apps/alsijil/schema/documentation.py
@@ -10,6 +10,7 @@ from reversion import create_revision, set_comment, set_user
 
 from aleksis.apps.alsijil.util.predicates import can_edit_documentation, is_in_allowed_time_range
 from aleksis.apps.chronos.models import LessonEvent
+from aleksis.apps.chronos.schema import LessonEventType
 from aleksis.apps.cursus.models import Subject
 from aleksis.apps.cursus.schema import CourseType, SubjectType
 from aleksis.core.models import Person
@@ -45,6 +46,7 @@ class DocumentationType(PermissionsTypeMixin, DjangoFilterMixin, DjangoObjectTyp
         }
 
     course = graphene.Field(CourseType, required=False)
+    amends = graphene.Field(lambda: LessonEventType, required=False)
     subject = graphene.Field(SubjectType, required=False)
 
     future_notice = graphene.Boolean(required=False)
-- 
GitLab