From 280cdfb479835bf8cf9eceed90808d1058d67d28 Mon Sep 17 00:00:00 2001 From: Aleks Acimovic Date: Fri, 10 May 2024 17:10:18 +0200 Subject: [PATCH] Update cms_plugins.py - isort/flake8 check (#60) * Update cms_plugins.py - isort/flake8 check * Update cms_plugins.py --------- Co-authored-by: Fabian Braun --- djangocms_column/cms_plugins.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/djangocms_column/cms_plugins.py b/djangocms_column/cms_plugins.py index 627ca8d..909a312 100644 --- a/djangocms_column/cms_plugins.py +++ b/djangocms_column/cms_plugins.py @@ -1,6 +1,6 @@ from django.utils.translation import gettext_lazy as _ -from cms.models import CMSPlugin +from cms import api from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool @@ -22,13 +22,12 @@ def save_model(self, request, obj, form, change): request, obj, form, change ) for _x in range(int(form.cleaned_data['create'])): - col = Column( - parent=obj, + col = api.add_plugin( placeholder=obj.placeholder, + plugin_type=ColumnPlugin.__name__, language=obj.language, + target=obj, width=form.cleaned_data['create_width'], - position=CMSPlugin.objects.filter(parent=obj).count(), - plugin_type=ColumnPlugin.__name__ ) col.save() return response