Hi Russel, Thanks a lot, it worked now.
I can't drop the related_name clause, in the Profile model I have two relationships to the User model: user (OneToOne) and friends (M2M). Then Django complains that the reverse query names clashes on those fields, forcing me to use a related_name. If I use 'friends_set' in the related_name, it works, and it really is easier to understand. I ended up using something like this: lookup = ( # My friends (form.data.get('my') and Q(friends_set=request.user.id) or Q()) | # People who added me (form.data.get('who') and Q(profile__friends=request.user.id) or Q()) ) Best regards, Enrico --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---