On Wednesday 12 July 2006 21:27, Gary Wilson wrote:
> Jay Parlar wrote:
> > You can use functions inside list_display:
> >
> >     class Admin:
> >         list_display = ('get_last_name',)
> >
> >     def get_last_name(self):
> >         return self.user.last_name
> >     get_last_name.short_description = "Last Name"
>
> But you can't sort or seach it.

Because that is impossible to do in SQL.  Consider the case, for 
example, where you've got 1,000,000 rows, and need to get display page 
20, containing items 2000 - 2100 in the admin.  You can only do that 
efficiently if you do it in SQL

You could, however, write an SQL view which provided the columns you 
wanted to search/sort on, and use that instead of your table.  To 
update records your DB will have to support updateable views (or 
perhaps you could do some hacks in .save())

Luke

-- 
If you can't answer a man's arguments, all is not lost; you can still 
call him vile names. (Elbert Hubbard)

Luke Plant || L.Plant.98 (at) cantab.net || http://lukeplant.me.uk/

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@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-developers
-~----------~----~----~----~------~----~------~--~---

Reply via email to