On 7/12/06, Gary Wilson <[EMAIL PROTECTED]> wrote: > > So I've got a model resembling: > > ========== > from django.contrib.auth.models import User > > class ExtendedUser(models.Model): > user = models.OneToOneField(User) > > class Admin: > list_display = ('user',) > search_fields = ('user',) > ========== > > The admin has a user column but it is sorted by User.id and therefore > not sorted alphabetically. Nor can you search on the string that > User.__str__ returns. This makes things very difficult. I think it > would be nice if the related object's fields were allowed for > list_display, search_fields, etc. This would be allowed for > OneToOneFields and ForeignKeys.
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" --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---