From 5f916371780db4cf4e4c12da1807d5e48bc71257 Mon Sep 17 00:00:00 2001 From: Stefan Wehrmeyer Date: Tue, 20 Jun 2023 12:14:31 +0200 Subject: [PATCH] Add copy_relations method on CMS plugin model recommended by cms check --- froide_govplan/models.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/froide_govplan/models.py b/froide_govplan/models.py index 6f97da4..1319267 100644 --- a/froide_govplan/models.py +++ b/froide_govplan/models.py @@ -481,7 +481,6 @@ class GovernmentPlanSection(models.Model): if CMSPlugin: - PLUGIN_TEMPLATES = [ ("froide_govplan/plugins/default.html", _("Normal")), ("froide_govplan/plugins/progress.html", _("Progress")), @@ -594,6 +593,12 @@ if CMSPlugin: help_text=_("number of updates to skip from top of list"), ) + def copy_relations(self, old_instance): + """ + Duplicate ManyToMany relations on plugin copy + """ + self.categories.set(old_instance.categories.all()) + def get_updates(self, request, published_only=True): # TODO: remove duplication with GovernmentPlansCMSPlugin.get_plans if (