fix mptt command #1521

merged 2 commits into from Nov 27, 2012


None yet

3 participants

digi604 commented Nov 19, 2012

Adds a command for fixing the mptt tree

@piquadrat piquadrat commented on an outdated diff Nov 19, 2012
@@ -0,0 +1,16 @@
+from cms.models import Page, CMSPlugin
+from import NoArgsCommand
+class FixMPTTCommand(NoArgsCommand):
+ help = 'Repair MPTT tree for pages'
+ def handle_noargs(self, **options):
+ """
+ Repairs the MPTT tree
+ """
+ print "fixing mptt page tree"
piquadrat Nov 19, 2012 Contributor

self.stdout.write is probably safer than print


I suggest to print a huge warning to please back up the database before running this command and ask for confirmation again (perhaps with a --noprint flag for automated calls)


Oh, I didn't saw TreeManager was accessible from Page._tree_manager. Is #1492 therefore invalid?

@digi604 digi604 merged commit 0607ff7 into divio:develop Nov 27, 2012

1 check was pending

default The Travis build is in progress
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment