From 97f20ff01f16cf1e57b730395005dfb78c92072a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jonathan=20Kr=C3=BCger?= <jonathan+edugit@mag-roboter.de>
Date: Tue, 12 Apr 2022 12:43:37 +0200
Subject: [PATCH] Delete the update() method from AutomaticPlan

---
 CHANGELOG.rst                  |  2 +-
 aleksis/apps/chronos/models.py | 15 ++-------------
 2 files changed, 3 insertions(+), 14 deletions(-)

diff --git a/CHANGELOG.rst b/CHANGELOG.rst
index 35f89f7f..5259e9a0 100644
--- a/CHANGELOG.rst
+++ b/CHANGELOG.rst
@@ -13,7 +13,7 @@ Changed
 ~~~~~~~
 
 * Change the icon set to iconify.
-
+* Remove the update() method in AutomaticPlan.
 
 `2.3`_ - 2022-03-21
 -------------------
diff --git a/aleksis/apps/chronos/models.py b/aleksis/apps/chronos/models.py
index 5e2690b5..04148bf3 100644
--- a/aleksis/apps/chronos/models.py
+++ b/aleksis/apps/chronos/models.py
@@ -1249,6 +1249,8 @@ class ExtraLesson(
 class AutomaticPlan(LiveDocument):
     """Model for configuring automatically updated PDF substitution plans."""
 
+    template = "chronos/substitutions_print.html"
+
     number_of_days = models.PositiveIntegerField(
         default=1,
         validators=[MinValueValidator(1)],
@@ -1324,19 +1326,6 @@ class AutomaticPlan(LiveDocument):
                 self.last_substitutions_revision = revision
                 self.save()
 
-    def update(self, triggered_manually: bool = True):
-        """Regenerate the PDF file with the substitutions plan."""
-        file_object, result = generate_pdf_from_template(
-            "chronos/substitutions_print.html", self.get_context_data()
-        )
-        with allow_join_result():
-            result.wait()
-            file_object.refresh_from_db()
-            if result.status == SUCCESS and file_object.file:
-                self.last_update_triggered_manually = triggered_manually
-                self.current_file.save(self.filename, file_object.file.file)
-                self.save()
-
     class Meta:
         verbose_name = _("Automatic plan")
         verbose_name_plural = _("Automatic plans")
-- 
GitLab