How to join a search on user and user profile

2010-11-21 Thread Rogério Carrasqueira
Hello Folks! I'm working on my system that has 2 classes to work with user managemet: User and UserProfile, and I would like to make on admin an unified search. For example I would like to find a user by e-mail at User class and all User that is female or something like that. So, Is there anyway t

Re: How to join a search on user and user profile

2010-11-22 Thread Chris Lawlor
You should be able to do something like: UserProfile.objects.filter(gender='female', user__email='some...@mail.com') Note the double underscore notation, which let's you access attributes of the related model. This example assumes that UserProfile has a FK field to User which is named 'user'. On

Re: How to join a search on user and user profile

2010-11-22 Thread Rogério Carrasqueira
Thanks Chris, But I would like to use on admin, using the search_fields Cheers Rogério Carrasqueira --- e-mail: rogerio.carrasque...@gmail.com skype: rgcarrasqueira MSN: rcarrasque...@hotmail.com ICQ: 50525616 Tel.: (11) 7805-0074 2010/11/22 Chris Lawlor > You should be able to do somethin

Re: How to join a search on user and user profile

2010-11-28 Thread Rogério Carrasqueira
Some one can help? Rogério Carrasqueira --- e-mail: rogerio.carrasque...@gmail.com skype: rgcarrasqueira MSN: rcarrasque...@hotmail.com ICQ: 50525616 Tel.: (11) 7805-0074 Em 22 de novembro de 2010 15:47, Rogério Carrasqueira < rogerio.carrasque...@gmail.com> escreveu: > Thanks Chris, > > But I

Re: How to join a search on user and user profile

2010-11-28 Thread Rogério Carrasqueira
Sorry for botter you John. I found my information: search_fields = ['foreign_key__related_fieldname'] http://docs.djangoproject.com/en/dev/ref/contrib/admin/ Thanks so much! Rogério Carrasqueira --- e-mail: rogerio.carrasque...@gmail.com skype: rgcarrasqueira MSN: rcarrasque...@hotmail.com ICQ