﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
7942	Admin doc does not reflect the fact that  In multi-column ordering, only the first column is used.	Martin Diers	MattBowen	"When setting the ordering property in the ModelAdmin class for a model, to a multiple column tuple, the resulting order is not correct.

In my case, I am working with an MPTT tree, such that I have tree_id, level, and lft properties, which I am using to sort.

Here is my ModelAdmin class:

{{{
class PageOptions(ModelAdmin):
    list_display = ('name', 'page_url', 'description','tree_id', 'level', 'lft')
    ordering = ('tree_id','level','lft',)
    fieldsets = (
        ('Content', {'fields': ('name','title','description','page_url','content','template','menu_text', 'other_menu_text')}),
        ('MPTT', {'fields': ('lft','rght','tree_id','level'), 'classes': ('collapse','wide')}),
    )
}}}

Here is my Model:


{{{
class Page(models.Model):
    name = models.CharField(max_length=25)
    title = models.CharField(max_length=80,null=True)
    description = models.TextField(null=True)
    menu_text = models.CharField(max_length=25, null=True, blank=True, help_text=""Leave blank to exclude from menu."")
    other_menu_text = models.CharField(max_length=25, null=True, blank=True, help_text=""Assigns this page to an alternate menu. Leave blank to exclude from menu."")
    page_url = models.CharField(max_length=20, unique=True)
    template = models.ForeignKey(Template, limit_choices_to = {'page_template': True})
    content = models.TextField()
    # The following fields are for implementing MPTT
    parent = models.ForeignKey('self', null=True, blank=True, related_name='children')
    lft = models.PositiveIntegerField(null=True, blank=True)
    rght = models.PositiveIntegerField(null=True, blank=True)
    tree_id = models.PositiveIntegerField(null=True, blank=True)
    level = models.PositiveIntegerField(null=True, blank=True)    
    
    class Meta:
        ordering = ('tree_id','level','lft',)

    def __unicode__(self):
        return self.name

    def get_absolute_url(self):
        path = list(self.get_ancestors().values_list('page_url', flat=True))
        path.append(self.page_url)
        return ""/"" + ""/"".join(path)        
}}}


And this is the sort I am getting:

{{{
tree level lft
  2    0    1
  3    1    4
  3    0    1
  3    1    6
  3    1    2
  4    0    1  
}}}

As you can see, it is sorting on the first column, and ignoring the other two. I tried this with and without the ordering property in the model's Meta class.
This may be related to #7309.
"		closed	Documentation	dev		fixed			Accepted	1	0	0	0	0	0
