Sunday, November 28, 2010

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

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.carrasqueira@gmail.com
skype: rgcarrasqueira
MSN: rcarrasqueira@hotmail.com
ICQ: 50525616
Tel.: (11) 7805-0074



Em 28 de novembro de 2010 20:03, Rogério Carrasqueira <rogerio.carrasqueira@gmail.com> escreveu:
Yes, I would like to search on admin using the search_fields atribbute at admin.py.

Thanks

Rogério Carrasqueira

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

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



Em 28 de novembro de 2010 19:59, John B <jbb582@gmail.com> escreveu:

Hi Rogério,

I think I have solved your problem in the past. I'll have a look and
email you some code.

Do you mean that you would like user fields to appear in the
UserProfile admin section? And you'd like to search/filter by these
User fields as well as the UserProfile fields?

Cheers,

John


On Nov 29, 8:02 am, 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 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 <lawlor.ch...@gmail.com>
>
> > 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 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<django-users%2Bunsubscribe@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