Add copy_relations method on CMS plugin model

recommended by cms check
This commit is contained in:
Stefan Wehrmeyer 2023-06-20 12:14:31 +02:00
parent 70ca66ebd5
commit 5f91637178

View file

@ -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 (