From 7a283d6714221947a359722b87af75f2baf6dddb Mon Sep 17 00:00:00 2001 From: Aleks Acimovic Date: Fri, 10 May 2024 17:00:33 +0200 Subject: [PATCH 1/2] Update cms_plugins.py - isort/flake8 check --- djangocms_column/cms_plugins.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/djangocms_column/cms_plugins.py b/djangocms_column/cms_plugins.py index 627ca8d..0510850 100644 --- a/djangocms_column/cms_plugins.py +++ b/djangocms_column/cms_plugins.py @@ -1,8 +1,7 @@ -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 +from django.utils.translation import gettext_lazy as _ from .forms import MultiColumnForm from .models import Column, MultiColumns @@ -22,13 +21,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 From 19b1ea5286925b0896c55f4915dd9100a9d88cb0 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Fri, 10 May 2024 17:09:39 +0200 Subject: [PATCH 2/2] Update cms_plugins.py --- djangocms_column/cms_plugins.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/djangocms_column/cms_plugins.py b/djangocms_column/cms_plugins.py index 0510850..909a312 100644 --- a/djangocms_column/cms_plugins.py +++ b/djangocms_column/cms_plugins.py @@ -1,7 +1,8 @@ +from django.utils.translation import gettext_lazy as _ + from cms import api from cms.plugin_base import CMSPluginBase from cms.plugin_pool import plugin_pool -from django.utils.translation import gettext_lazy as _ from .forms import MultiColumnForm from .models import Column, MultiColumns