On 7/28/06, Seth Buntin <[EMAIL PROTECTED]> wrote:
> I have a model class that returns the string as below:
>
> def __str__(self):
>     return "%s %s" % (self.program, self.course_number)
>
> In the list_display I have:
>     list_display = ('__str__', 'uploaded')
>
> I want to be able to order by my __str__ value, but I don't know how.

It's not possible to order by __str__(), because ordering happens at
the database level, not at the Python level. There's no __str__ column
in your database table. To make that happen, set "ordering" to the
fields of your model, rather than the __str__.

Adrian

-- 
Adrian Holovaty
holovaty.com | djangoproject.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to