Skip to content

Commit 3e87a59

Browse files
committed
Fix crash when scanning template components
1 parent 2590b6e commit 3e87a59

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

djangocms_frontend/templatetags/frontend.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ def is_registering_component(context: template.Context) -> bool:
3232
)
3333

3434

35+
def is_inline_editing_active(context: template.Context) -> bool:
36+
if "request" in context:
37+
return context["request"].session.get("inline_editing", True)
38+
return False
39+
40+
3541
def update_component_properties(context: template.Context, key: str, value: typing.Any, append: bool = False) -> None:
3642
""""Adds or appends the value to the property "key" of a component during delcaration"""
3743
args, kwargs = context["_cms_components"]["cms_component"][0]
@@ -312,9 +318,8 @@ def render_tag(self, context, instance, attribute, **kwargs):
312318

313319
if is_registering_component(context) and attribute:
314320
update_component_properties(context, "frontend_editable_fields", attribute, append=True)
315-
print("After update", context["_cms_components"]["cms_component"][0])
316321
elif (
317-
context["request"].session.get("inline_editing", True)
322+
is_inline_editing_active(context)
318323
and isinstance(instance, CMSPlugin)
319324
and instance.pk
320325
):

0 commit comments

Comments
 (0)