django join querysets from multiple tables

Posted by dana on Stack Overflow See other posts from Stack Overflow or by dana
Published on 2010-06-14T10:03:15Z Indexed on 2010/06/14 11:02 UTC
Read the original article Hit count: 170

Filed under:
|
|
|
|

if i have queries on multiple tables like:

d = Relations.objects.filter(follow = request.user).filter(date_follow__lt = last_checked)
r = Reply.objects.filter(reply_to = request.user).filter(date_reply__lt = last_checked)
article = New.objects.filter(created_by = request.user)
vote = Vote.objects.filter(voted = article).filter(date__lt = last_checked)

and i want to display the results from all of them ordered by date (i mean not listing all the replies, then all the votes, etc ). Somehow, i want to 'join all these results', in a single queryset. Is there possible?

© Stack Overflow or respective owner

Related posts about django

Related posts about table