From 1792cf1f7f4575fe90b96d7fa4eae3ab74fac0dc Mon Sep 17 00:00:00 2001
From: Hangzhi Yu <hangzhi@protonmail.com>
Date: Sat, 16 Mar 2024 02:00:08 +0100
Subject: [PATCH] Add teachers field to documentation

---
 .../migrations/0022_documentation_teachers.py | 24 +++++++++++++++++++
 aleksis/apps/alsijil/models.py                |  4 ++++
 2 files changed, 28 insertions(+)
 create mode 100644 aleksis/apps/alsijil/migrations/0022_documentation_teachers.py

diff --git a/aleksis/apps/alsijil/migrations/0022_documentation_teachers.py b/aleksis/apps/alsijil/migrations/0022_documentation_teachers.py
new file mode 100644
index 000000000..8e6c30bd9
--- /dev/null
+++ b/aleksis/apps/alsijil/migrations/0022_documentation_teachers.py
@@ -0,0 +1,24 @@
+# Generated by Django 4.2.9 on 2024-03-16 00:59
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+    dependencies = [
+        ("core", "0061_remove_group_additional_fields"),
+        ("alsijil", "0021_participationstatus"),
+    ]
+
+    operations = [
+        migrations.AddField(
+            model_name="documentation",
+            name="teachers",
+            field=models.ManyToManyField(
+                blank=True,
+                null=True,
+                related_name="documentations_as_teacher",
+                to="core.person",
+                verbose_name="Teachers",
+            ),
+        ),
+    ]
diff --git a/aleksis/apps/alsijil/models.py b/aleksis/apps/alsijil/models.py
index e86bbed4c..74f294315 100644
--- a/aleksis/apps/alsijil/models.py
+++ b/aleksis/apps/alsijil/models.py
@@ -474,6 +474,10 @@ class Documentation(CalendarEvent):
         Subject, models.PROTECT, related_name="+", blank=True, null=True, verbose_name=_("Subject")
     )
 
+    teachers = models.ManyToManyField(
+        "core.Person", related_name="documentations_as_teacher", blank=True, null=True, verbose_name=_("Teachers")
+    )
+
     topic = models.CharField(verbose_name=_("Lesson Topic"), max_length=255, blank=True)
     homework = models.CharField(verbose_name=_("Homework"), max_length=255, blank=True)
     group_note = models.CharField(verbose_name=_("Group Note"), max_length=255, blank=True)
-- 
GitLab