Skip to content

Commit

Permalink
Merge pull request #2 from czpython/fixes/3.2-issue-4856
Browse files Browse the repository at this point in the history
adds fix for #4856
  • Loading branch information
czpython committed Dec 29, 2015
2 parents 9bdeec0 + 7614d51 commit 5be5157
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion cms/models/pluginmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ def save(self, no_signals=False, *args, **kwargs):
placeholder_id=self.placeholder_id).count()
self.add_root(instance=self)
return
super(CMSPlugin, self).save()
super(CMSPlugin, self).save(*args, **kwargs)

def reload(self):
return CMSPlugin.objects.get(pk=self.pk)
Expand Down
7 changes: 6 additions & 1 deletion cms/utils/copy_plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ def copy_plugins_to(old_plugins, to_placeholder,
for idx, plugin in enumerate(new_plugins):
if plugin.parent_id is None:
plugin.parent_id = parent_plugin_id
plugin.save()
# Always use update fields to avoid side-effects.
# In this case "plugin" has invalid values for internal fields
# like numchild.
# The invalid value is only in memory because the instance
# was never updated.
plugin.save(update_fields=['parent'])
new_plugins[idx] = plugin.move(parent_plugin, pos="last-child")

plugins_ziplist = list(zip(new_plugins, old_plugins))
Expand Down

0 comments on commit 5be5157

Please sign in to comment.