Re: Admin model listing custom ordering

2011-08-09 Thread Vinicius Massuchetto
Thanks, Christian. After trying your attempts, I solved the problem by creating an additional "order" field in the ForeignKey. So in the referenced model I had to do: class Meta: ordering = ['fkfield__order'] That's not so elegant as I wished it to be, but it's not that ugly too, IMO. Vinic

Re: Admin model listing custom ordering

2011-07-28 Thread christian.posta
Is this something that can work for you? https://docs.djangoproject.com/en/1.3/ref/models/options/#order-with-respect-to If not, then the only thing i can do is recommend you review the source code for how the ordering happens in the admin module for a model. The main spots to look at would be t

Admin model listing custom ordering

2011-07-28 Thread Vinicius Massuchetto
I got a model with a ForeignKey field, and I want the default listing of this model to be ordered by this field. I get the correct `qs.query` SQL statement, but for some reason the admin listing is not following it. This is what I've done so far: class SomeAdminModel(admin.ModelAdmin):