On 2/5/07, Enrico <[EMAIL PROTECTED]> wrote:
>
> I need to list the Users, with the possibility of using two filters:
> my friends and people who added me.
>
> I can list people who added me using:
> users = auth.models.User.filter(profile__friends=some_user_id)
>
> But I can't get the list of people I added using a lookup,

me = auth.models.User.get(id=some_user_id)
my_users = me.profile.friends.all()

> and I can't
> just use the 'friends_set' method because I may need to combine the
> two filters.

If you want to filter the list of my_users, you can -
me.profile.friends is a query set that can be modified using any of
the normal filtering mechanisms:

my_users_filtered = me.profile.friends.filter(...)

Does this solve your problem?

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to