Skip to content

Commit fe8e86f

Browse files
committed
Fix AttributeError CMSPlugin (EditorNotePlugin) object has no attribute config.
1 parent 35d4231 commit fe8e86f

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

djangocms_frontend/ui_plugin_base.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,13 @@ def __str__(self):
3030
return force_str(super().__str__())
3131

3232
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)
33+
if hasattr(instance, "config"):
34+
for key, value in instance.config.items():
35+
if isinstance(value, dict) and set(value.keys()) == {"pk", "model"}:
36+
if key not in instance.__dir__(): # hasattr would return the value in the config dict
37+
setattr(instance.__class__, key, get_related(key))
38+
if "instance" not in instance.config and isinstance(instance.config, dict):
39+
context.update(instance.config)
3940
return super().render(context, instance, placeholder)
4041

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

0 commit comments

Comments
 (0)