title: Ordering mptt tree using a field
body: <p>This is the original category model:</p>
  
  <pre><code>class Category(MPTTModel):
      name = models.CharField(max_length=50, unique=True)
      parent = TreeForeignKey('self', null=True, blank=True, related_name='children')
  
      def __unicode__(self):
          return self.name
  
      class MPTTMeta:
          order_insertion_by = ['name']
  </code></pre>
  
  <p>Then I needed to order the category, so I altered it like the following:</p>
  
  <pre><code>class Category(MPTTModel):
      name = models.CharField(max_length=50, unique=True)
      order = models.SmallIntegerField() &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
      parent = TreeForeignKey('self', null=True, blank=True, related_name='children')
  
      def __unicode__(self):
          return self.name
  
      class MPTTMeta:
          order_insertion_by = ['order'] &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;
  </code></pre>
  
  <p>And I changed the Django admin declaration from:</p>
  
  <pre><code>admin.site.register(Category, MPTTModelAdmin)
  </code></pre>
  
  <p>To:</p>
  
  <pre><code>class CategoryAdmin(MPTTModelAdmin):
      list_display = ('name', 'order')
      list_editable = ('order',)
  
  
  admin.site.register(Category, CategoryAdmin)
  </code></pre>
  
  <p>Then everything fall apart after making a few edits from the admin control panel. I can't describe exactly what happened but it seems the <code>lft</code>, <code>rght</code>, <code>level</code> and <code>parent_id</code> where messed up by these changes.</p>
  
  <p>Am I using <code>order_insertion_by</code> in the wrong context? Is it for something else? I tried to search the docs but didn't get a useful answer.</p>