Skip to content

Commit

Permalink
fix: Disallow edit for DummyPlugins
Browse files Browse the repository at this point in the history
  • Loading branch information
fsbraun committed Oct 7, 2024
1 parent 290e2a8 commit 4b4c237
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions djangocms_frontend/templatetags/frontend.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
from classytags.arguments import Argument, MultiKeywordArgument
from classytags.core import Options, Tag
from classytags.helpers import AsTag
from cms.models import CMSPlugin
from cms.templatetags.cms_tags import CMSEditableObject, render_plugin
from django import template
from django.conf import settings as django_settings
Expand Down Expand Up @@ -263,8 +264,9 @@ class InlineField(CMSEditableObject):
)

def render_tag(self, context, **kwargs):
if context["request"].session.get("inline_editing", True):
# Only allow inline field to be rendered if inline editing is active
if context["request"].session.get("inline_editing", True) and isinstance(kwargs["instance"], CMSPlugin):
# Only allow inline field to be rendered if inline editing is active and the instance is a CMSPlugin
# DummyPlugins of the ``plugin`` tag are cannot be edited
kwargs["edit_fields"] = kwargs["attribute"]
return super().render_tag(context, **kwargs)
else:
Expand Down

0 comments on commit 4b4c237

Please sign in to comment.