On Fri, Oct 31, 2008 at 10:24 AM, Fabio Natali
<[EMAIL PROTECTED]>wrote:

>
> Rajesh Dhawan wrote:
> [...]
> > > What's more, how can I make those callables columns sortable
> > > within the change list page? I'm working with trunk. I read this:
> > > http://code.djangoproject.com/changeset/9211 Does this mean that I
> > > can add some callable and then alphabetically order them?
> >
> > No. While you can definitely add a callable column in the change
> > list[1], you can only sort by fields that are in the database table.
>
> Ok, we can't sort on callable columns. Anyway that's a pity... I
> thought providing a straight lexicographic order was not such a big
> deal. (But I probably miss some points and misjudge the difficulty of
> the matter.)
>
>
The sorting is done at the database level (SQL ORDER BY), as is the
pagination (SQL OFFSET & LIMIT), so it is efficient (DBs are optimized to do
these things efficiently).  In order to sort by something not in the
database, Django would need to retrieve all rows, do the sort (calling your
callable for each row in the DB), and then limit the result according to the
page you are viewing.  This would be prohibitively expensive for large
tables.

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-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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to