Improved the initial mptt migration by adding automated tree rebuilds.
authorStephen Burrows <stephen.r.burrows@gmail.com>
Mon, 29 Nov 2010 16:06:57 +0000 (11:06 -0500)
committerStephen Burrows <stephen.r.burrows@gmail.com>
Mon, 29 Nov 2010 22:19:34 +0000 (17:19 -0500)
migrations/0009_auto__add_field_node_lft__add_field_node_rght__add_field_node_tree_id_.py

index a6f58fd..d77affa 100644 (file)
@@ -3,6 +3,8 @@ import datetime
 from south.db import db
 from south.v2 import SchemaMigration
 from django.db import models
+from philo.models import Node, Template
+
 
 class Migration(SchemaMigration):
 
@@ -32,6 +34,10 @@ class Migration(SchemaMigration):
         # Adding field 'Template.level'
         db.add_column('philo_template', 'level', self.gf('django.db.models.fields.PositiveIntegerField')(default=1, db_index=True), keep_default=False)
 
+        # Rebuild trees!
+        Template._tree_manager.rebuild()
+        Node._tree_manager.rebuild()
+
 
     def backwards(self, orm):