Sunday, November 28, 2010

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

Some one can help?
Rogério Carrasqueira

---
e-mail: rogerio.carrasqueira@gmail.com
skype: rgcarrasqueira
MSN: rcarrasqueira@hotmail.com
ICQ: 50525616
Tel.: (11) 7805-0074



Em 22 de novembro de 2010 15:47, Rogério Carrasqueira <rogerio.carrasqueira@gmail.com> escreveu:
Thanks Chris,

But I would like to use on admin, using the search_fields

Cheers

Rogério Carrasqueira

---
e-mail: rogerio.carrasqueira@gmail.com
skype: rgcarrasqueira
MSN: rcarrasqueira@hotmail.com

ICQ: 50525616
Tel.: (11) 7805-0074



2010/11/22 Chris Lawlor <lawlor.chris@gmail.com>

You should be able to do something like:

UserProfile.objects.filter(gender='female',
user__email='someone@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 Nov 21, 10:36 pm, Rogério Carrasqueira
<rogerio.carrasque...@gmail.com> wrote:
> 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 to work on this
> direction?
>
> Thanks
>
> Rogério Carrasqueira
>
> ---
> e-mail: rogerio.carrasque...@gmail.com
> skype: rgcarrasqueira
> MSN: rcarrasque...@hotmail.com
> ICQ: 50525616
> Tel.:(11) 7805-0074

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.



--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment