Re: allow list_display in admin to traverse onetoonfields and foreign key relations

2014-02-26 Thread Russell Keith-Magee
Hi Wim, On Wed, Feb 26, 2014 at 7:48 AM, Wim Feijen wrote: > Hello, > > Right now I have a School model containing a OneToOne-relation to User. > > In the admin, in search_fields, I can use double underscores to search in > related fields, for example: > search_fields = ('place__name', 'scho

Re: allow list_display in admin to traverse onetoonfields and foreign key relations

2014-02-26 Thread Gwildor Sok
Personally I usually use lambda's, which saves another line of code: class ChoiceAdmin(admin.ModelAdmin): question__text = lambda s, o: o.question.text list_display = ('pk', 'question__text', 'choice_text', 'votes') On Wednesday, February 26, 2014 6:49:51 AM UTC+1, Zach Borboa wrote: >

Re: allow list_display in admin to traverse onetoonfields and foreign key relations

2014-02-25 Thread Zach Borboa
I agree that the current behaviour is confusing and needs change in order to be DRY[1] and consistent[2]. [1] https://docs.djangoproject.com/en/dev/misc/design-philosophies/#don-t-repeat-yourself-dry [2] https://docs.djangoproject.com/en/dev/misc/design-philosophies/#consistency This is how I

allow list_display in admin to traverse onetoonfields and foreign key relations

2014-02-25 Thread Wim Feijen
Hello, Right now I have a School model containing a OneToOne-relation to User. In the admin, in search_fields, I can use double underscores to search in related fields, for example: search_fields = ('place__name', 'school__name') But in list_display, I can't. For example, list_display =