Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nested plugins don't fully copy to new placeholder #6650

mailbackwards opened this Issue Mar 12, 2019 · 0 comments


None yet
1 participant
Copy link

mailbackwards commented Mar 12, 2019


We have a few plugins that are associated directly with the CMSPlugin model (rather than a concrete subclass), and can also be inserted as children of TextPlugin. However, these do not get along with the copy_plugins placeholder method, as new copies of the placeholder don't include these children.

When copy_plugins is run, it checks whether the plugin's model is a CMSPlugin; if so, it doesn't append it to the list...

if plugin_model != CMSPlugin:
plugin_pairs.append((new_plugin, source_plugin))

...which means it's not included in this post_copy command farther along in the function:

# Backwards compatibility
# This magic is needed for advanced plugins like Text Plugins that can have
# nested plugins and need to update their content based on the new plugins.
for new_plugin, old_plugin in plugin_pairs:
new_plugin.post_copy(old_plugin, plugin_pairs)

So the plugins are created, but its IDs are never reset here and don't appear in the editor.

Suggested solution: if we un-indent this line the rest would work fine. I can open a PR if this looks right, but don't know if this would break other functionality.

Expected behaviour

When I run placeholder.copy_plugins(copy), I expect copy to have every plugin, including children of TextPlugins that use the base CMSPlugin as their model.

Actual behaviour

I do not get copies of plugins that are both a) directly using CMSPlugin as their model; and b) are children of TextPlugins.


  • Python version: 3.6
  • Django version: 1.11
  • django CMS version: 3.5.3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.