Skip to content

Commit 0a949bb

Browse files
committed
Fix AttributeError CMSPlugin (EditorNotePlugin) object has no attribute config.
1 parent 1ef2bc7 commit 0a949bb

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

djangocms_frontend/ui_plugin_base.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
from django.utils.encoding import force_str
44

55
from djangocms_frontend.helpers import get_related
6+
from djangocms_frontend.models import AbstractFrontendUIItem
67

78
try:
89
from cms.admin.placeholderadmin import PlaceholderAdmin
@@ -30,12 +31,13 @@ def __str__(self):
3031
return force_str(super().__str__())
3132

3233
def render(self, context, instance, placeholder):
33-
for key, value in instance.config.items():
34-
if isinstance(value, dict) and set(value.keys()) == {"pk", "model"}:
35-
if key not in instance.__dir__(): # hasattr would return the value in the config dict
36-
setattr(instance.__class__, key, get_related(key))
37-
if "instance" not in instance.config and isinstance(instance.config, dict):
38-
context.update(instance.config)
34+
if isinstance(instance, AbstractFrontendUIItem):
35+
for key, value in instance.config.items():
36+
if isinstance(value, dict) and set(value.keys()) == {"pk", "model"}:
37+
if key not in instance.__dir__(): # hasattr would return the value in the config dict
38+
setattr(instance.__class__, key, get_related(key))
39+
if "instance" not in instance.config and isinstance(instance.config, dict):
40+
context.update(instance.config)
3941
return super().render(context, instance, placeholder)
4042

4143
if not hasattr(PlaceholderAdmin, "edit_field"):

0 commit comments

Comments
 (0)