On Nov 16, 8:31 am, Zeynel <
azeyn...@gmail.com> wrote:
> Thanks!
>
> I noticed that using
>
> class Lawyer(models.Model):
> ...
> ordering = ('last',)
>
> did not work.
>
> But this worked
>
> class Lawyer(models.Model):
> ...
> class Meta:
> ordering = ('last',)
>
> copied fromhttp://
www.djangoproject.com/documentation/models/ordering/
>
> What is the correct way actually?
If you notice - you are looking at two ways of doing it, depending
whether you want the ordering to be applied to just the model
(django.models.Model) or the ModelAdmin
(django.contrib.admin.ModelAdmin).
regular models use Meta class for ordering - ModelAdmin classes use an
ordering attribute.
The modeladmin docs say : "If this isn't provided, the Django admin
will use the model's default ordering."
so they are both "correct"
-Preston