On 1/12/06, Adrian Holovaty <[EMAIL PROTECTED] > wrote:
>
> You can do it in two queries:
>
> my_friends =  friends.get_list(myself__exact=my_id)
> entries.get_list(submission_user__in=[f.id for f in my_friends])

If you are using the magic-removal branch, there is an alternative
approach that only requires a single database query.

Using the __ relation walking notation, you can query across relations:

entrys.get_list(submission_user__friend__myself__id__exact=my_id, distinct=True)

The distinct is required because the join over the reverse direction
of the ForeignKey can will yield a duplicate for each Friend of the
Submission_User that matches the criteria.

Russ Magee %-)

Reply via email to