Skip to content

Commit 462d07a

Browse files
committed
Fix LinkPluginMixin
1 parent b818bcd commit 462d07a

File tree

2 files changed

+2
-34
lines changed

2 files changed

+2
-34
lines changed

djangocms_frontend/contrib/image/forms.py

Lines changed: 1 addition & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from django.conf import settings as django_settings
33
from django.db.models.fields.related import ManyToOneRel
44
from django.utils.translation import gettext_lazy as _
5-
from entangled.forms import EntangledModelForm
65
from filer.fields.image import AdminImageFormField, FilerImageField
76
from filer.models import Image, ThumbnailOption
87

@@ -45,13 +44,6 @@ def get_templates():
4544
PICTURE_ALIGNMENT = get_alignment()
4645

4746

48-
LINK_TARGET = (
49-
("_blank", _("Open in new window")),
50-
("_self", _("Open in same window")),
51-
("_parent", _("Delegate to parent")),
52-
("_top", _("Delegate to top")),
53-
)
54-
5547
RESPONSIVE_IMAGE_CHOICES = (
5648
("inherit", _("Let settings.DJANGOCMS_PICTURE_RESPONSIVE_IMAGES decide")),
5749
("yes", _("Yes")),
@@ -61,10 +53,9 @@ def get_templates():
6153

6254
class ImageForm(
6355
TemplateChoiceMixin,
64-
AbstractLinkForm,
6556
ResponsiveFormMixin,
6657
MarginFormMixin,
67-
EntangledModelForm,
58+
AbstractLinkForm,
6859
):
6960
"""
7061
Content > "Image" Plugin
@@ -217,24 +208,6 @@ class Meta:
217208
def clean(self):
218209
super().clean()
219210
data = self.cleaned_data
220-
# there can be only one link type
221-
if (
222-
sum(
223-
(
224-
bool(data.get("external_link", False)),
225-
bool(data.get("internal_link", False)),
226-
bool(data.get("file_link", False)),
227-
)
228-
)
229-
> 1
230-
):
231-
raise forms.ValidationError(
232-
_(
233-
"You have given more than one external, internal, or file link target. "
234-
"Only one option is allowed."
235-
)
236-
)
237-
238211
# you shall only set one image kind
239212
if not data.get("picture", False) and not data.get("external_picture", False):
240213
raise forms.ValidationError(

djangocms_frontend/contrib/link/cms_plugins.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,7 @@ class LinkPluginMixin:
4040
link_fields = (
4141
(("site", "url_grouper"),)
4242
if apps.is_installed("djangocms_url_manager")
43-
else (
44-
("external_link", "internal_link"),
45-
("mailto", "phone"),
46-
("anchor", "target"),
47-
"file_link",
48-
)
43+
else ("link", "target")
4944
)
5045

5146
def render(self, context, instance, placeholder):

0 commit comments

Comments
 (0)