Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update cms_plugins.py - now using cms.api to add columns #59

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions djangocms_column/cms_plugins.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from django.utils.translation import gettext_lazy as _

Check failure on line 1 in djangocms_column/cms_plugins.py

View workflow job for this annotation

GitHub Actions / isort

Imports are incorrectly sorted and/or formatted.

from cms.models import CMSPlugin

Check failure on line 3 in djangocms_column/cms_plugins.py

View workflow job for this annotation

GitHub Actions / flake8

'cms.models.CMSPlugin' imported but unused
from cms.plugin_base import CMSPluginBase
from cms.plugin_pool import plugin_pool

from cms import api
from .forms import MultiColumnForm
from .models import Column, MultiColumns

Expand All @@ -22,13 +22,12 @@
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
Expand Down
Loading