On 1/11/06, Cheng Zhang <[EMAIL PROTECTED]> wrote:
> class Entry(meta.Model):
>         submission_user = meta.ForeignKey(users.User)
>
> class Friend(meta.Model):
>         myself = meta.ForeignKey(users.User, related_name="myself",
> verbose_name="myself")
>         friend = meta.ForeignKey(users.User, related_name="friend",
> verbose_name="friend")
>
> How may I get a list of entry whose submission_user is in my friend
> list, which is myself == my_id?

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])

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Reply via email to