|
3 | 3 | from django.utils.encoding import force_str
|
4 | 4 |
|
5 | 5 | from djangocms_frontend.helpers import get_related
|
| 6 | +from djangocms_frontend.models import AbstractFrontendUIItem |
6 | 7 |
|
7 | 8 | try:
|
8 | 9 | from cms.admin.placeholderadmin import PlaceholderAdmin
|
@@ -30,12 +31,13 @@ def __str__(self):
|
30 | 31 | return force_str(super().__str__())
|
31 | 32 |
|
32 | 33 | 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) |
39 | 41 | return super().render(context, instance, placeholder)
|
40 | 42 |
|
41 | 43 | if not hasattr(PlaceholderAdmin, "edit_field"):
|
|
0 commit comments