On 11/5/05, Le Roux Bodenstein <[EMAIL PROTECTED]> wrote:
> admin = meta.Admin(
>             list_display = ("name", "short_description",
> "get_owner_fullname", "created")
>         )
> ...
>     def get_owner_fullname(self):
>         owner = self.get_owner()
>         return owner.first_name + " " + owner.last_name
>
>     get_owner_fullname.short_description = "Owner Name"
> ...
>
> Is there a way to tell the admin interface to pass select_related=True
> to the lookup for the listing? Then I don't have to do a query for
> each row in the listing and I can just somehow use the owner object
> directly.

Yes! As of one minute ago, I added a "list_select_related" option to
meta.Admin. Thanks for the great suggestion.

Note that Django automatically adds select_related=True to its query
on the "change list" page if the list_display includes a ForeignKey
field. As you noted, though, using a custom method
("get_owner_fullname") doesn't tell Django that you're using a
ForeignKey.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Reply via email to