[BUG] `CMS_PLACEHOLDER_CONF` breaks child plugin restrictions
Description
Jasper has a plugin named TextAndMediaPlugin. This plugin can have two child plugins, one TextAndMediaContentPlugin and one TextAndMediaMediaPlugin. The CMS_PLACEHOLDER_CONF is used to restrict a placeholder's plugins to TextAndMediaPlugin and BlockPlugin.
TextAndMediaPlugin can only have a TextAndMediaContentPlugin and a TextAndMediaMediaPlugin, but the BlockPlugin should allow any plugin as a child.
Steps to reproduce
The plugin classes are configured like this:
class TextAndMediaPlugin(CMSPluginBase):
model = CMSPlugin
allow_children = True
child_classes = ["TextAndMediaContentPlugin", "TextAndMediaMediaPlugin"]
class TextAndMediaContentPlugin(CMSPluginBase):
model = CMSPlugin
parent_classes = ["TextAndMediaPlugin"]
allow_children = True
require_parent = True
class TextAndMediaMediaPlugin(CMSPluginBase):
model = CMSPlugin
parent_classes = ["TextAndMediaPlugin"]
allow_children = True
require_parent = TrueThe relevant part of the CMS placeholder configuration is this:
CMS_PLACEHOLDER_CONF = {
"content": {
"name": _("Content"),
"plugins": ["BlockPlugin", "TextAndMediaPlugin"],
},
}Expected behaviour
What I want to achieve is that a TextAndMediaPlugin can only have a TextAndMediaContentPlugin and a TextAndMediaMediaPlugin, but the BlockPlugin should allow any plugin as a child.
Actual behaviour
The above setup works in CMS 3.11, but updating to v5 it doesn't work the same. Using the config above, I can add ANY plugin to the TextAndMediaPlugin, while this should be limited to the two child plugins.
Do you want to help fix this issue?
- Yes, I want to help fix this issue and I will join the channel #pr-reviews on the Discord Server to confirm with the community that a PR is welcome.
- No, I only want to report the issue.
Source: django-cms/django-cms