You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Placeholder seems to merrily iterate through all plugins whilst rendering without checking whether some of them are actually embedded within others! For efficiency, it would probably be best to add an 'embedded' or 'nested' boolean field to the CMSPlugin class which can be set upon creation, however for now I have implemented a quick hack to get around it on my system:
diff --git a/cms/templatetags/cms_tags.py b/cms/templatetags/cms_tags.py
index afc34e2..22d2281 100644
--- a/cms/templatetags/cms_tags.py
+++ b/cms/templatetags/cms_tags.py
@@ -387,7 +387,18 @@ class PlaceholderNode(template.Node):
else:
plugins = CMSPlugin.objects.filter(page=page, language=l, placehold
c = ""
+
+ nested_ids = []
+ from cms.plugins.text.utils import OBJ_ADMIN_RE
+ for plugin in plugins:
+ i = plugin.get_plugin_instance()[0]
+ if getattr(i, 'body', False):
+ for m in OBJ_ADMIN_RE.findall(i.body):
+ nested_ids.append(int(m))
+
for plugin in plugins:
+ # check that it's not already nested
+ if plugin.id in nested_ids: continue
c += plugin.render_plugin(context, self.name)
if not c:
return ''
The text was updated successfully, but these errors were encountered:
should work again.... you can actually filter if the plugin has a parent or not. because plugins will be organized in a tree soon, mptt for them is already in place and used for the text plugin.
Placeholder seems to merrily iterate through all plugins whilst rendering without checking whether some of them are actually embedded within others! For efficiency, it would probably be best to add an 'embedded' or 'nested' boolean field to the CMSPlugin class which can be set upon creation, however for now I have implemented a quick hack to get around it on my system:
The text was updated successfully, but these errors were encountered: