Skip to content

Commit

Permalink
Merge pull request #3831 from yakky/feature/cleanup_mptt
Browse files Browse the repository at this point in the history
Cleanup CMSPlugin.save.
  • Loading branch information
yakky committed Feb 8, 2015
2 parents 9f7e199 + b28a782 commit f0f6420
Showing 1 changed file with 10 additions and 13 deletions.
23 changes: 10 additions & 13 deletions cms/models/pluginmodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -226,19 +226,16 @@ def get_instance_icon_alt(self):
return force_text(plugin.icon_alt(instance)) if instance else u''

def save(self, no_signals=False, *args, **kwargs):
if no_signals: # ugly hack because of mptt
super(CMSPlugin, self).save_base()
else:
if not self.depth:
if self.parent_id or self.parent:
self.parent.add_child(instance=self)
else:
if not self.position and not self.position == 0:
self.position == CMSPlugin.objects.filter(parent__isnull=True,
placeholder_id=self.placeholder_id).count()
self.add_root(instance=self)
return
super(CMSPlugin, self).save()
if not self.depth:
if self.parent_id or self.parent:
self.parent.add_child(instance=self)
else:
if not self.position and not self.position == 0:
self.position == CMSPlugin.objects.filter(parent__isnull=True,
placeholder_id=self.placeholder_id).count()
self.add_root(instance=self)
return
super(CMSPlugin, self).save()

def reload(self):
return CMSPlugin.objects.get(pk=self.pk)
Expand Down

0 comments on commit f0f6420

Please sign in to comment.