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


>
> On Nov 16, 10:22 am, Karen Tracey <kmtra...@gmail.com> wrote:
>
>
>
> > On Mon, Nov 16, 2009 at 10:11 AM, Zeynel <azeyn...@gmail.com> wrote:
> > > Hi,
>
> > > Is there a way to change the default sort order in admin of my sqlite
> > > db? At this point it sorts the table in the order entered (last
> > > entered item first).
>
> >http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contri...
>
> > Karen

--

You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=.


Reply via email to