From 462d07af9d02ef86f92dd3e3da0adaa42c9d7a65 Mon Sep 17 00:00:00 2001 From: Fabian Braun Date: Fri, 1 Nov 2024 19:56:12 +0100 Subject: [PATCH] Fix `LinkPluginMixin` --- djangocms_frontend/contrib/image/forms.py | 29 +------------------ .../contrib/link/cms_plugins.py | 7 +---- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/djangocms_frontend/contrib/image/forms.py b/djangocms_frontend/contrib/image/forms.py index 0a1043e1..09786199 100644 --- a/djangocms_frontend/contrib/image/forms.py +++ b/djangocms_frontend/contrib/image/forms.py @@ -2,7 +2,6 @@ from django.conf import settings as django_settings from django.db.models.fields.related import ManyToOneRel from django.utils.translation import gettext_lazy as _ -from entangled.forms import EntangledModelForm from filer.fields.image import AdminImageFormField, FilerImageField from filer.models import Image, ThumbnailOption @@ -45,13 +44,6 @@ def get_templates(): PICTURE_ALIGNMENT = get_alignment() -LINK_TARGET = ( - ("_blank", _("Open in new window")), - ("_self", _("Open in same window")), - ("_parent", _("Delegate to parent")), - ("_top", _("Delegate to top")), -) - RESPONSIVE_IMAGE_CHOICES = ( ("inherit", _("Let settings.DJANGOCMS_PICTURE_RESPONSIVE_IMAGES decide")), ("yes", _("Yes")), @@ -61,10 +53,9 @@ def get_templates(): class ImageForm( TemplateChoiceMixin, - AbstractLinkForm, ResponsiveFormMixin, MarginFormMixin, - EntangledModelForm, + AbstractLinkForm, ): """ Content > "Image" Plugin @@ -217,24 +208,6 @@ class Meta: def clean(self): super().clean() data = self.cleaned_data - # there can be only one link type - if ( - sum( - ( - bool(data.get("external_link", False)), - bool(data.get("internal_link", False)), - bool(data.get("file_link", False)), - ) - ) - > 1 - ): - raise forms.ValidationError( - _( - "You have given more than one external, internal, or file link target. " - "Only one option is allowed." - ) - ) - # you shall only set one image kind if not data.get("picture", False) and not data.get("external_picture", False): raise forms.ValidationError( diff --git a/djangocms_frontend/contrib/link/cms_plugins.py b/djangocms_frontend/contrib/link/cms_plugins.py index b4950755..dea1f3e1 100644 --- a/djangocms_frontend/contrib/link/cms_plugins.py +++ b/djangocms_frontend/contrib/link/cms_plugins.py @@ -40,12 +40,7 @@ class LinkPluginMixin: link_fields = ( (("site", "url_grouper"),) if apps.is_installed("djangocms_url_manager") - else ( - ("external_link", "internal_link"), - ("mailto", "phone"), - ("anchor", "target"), - "file_link", - ) + else ("link", "target") ) def render(self, context, instance, placeholder):