Django query - join on the same table
- by dana
i have a mini blog app, and a 'timeline' . there i want to be displayed all the posts from all the friends of a user, plus the posts of that user himself.
For that, i have to make some kind of a 'join' between the results of two queries (queries on the same table) , so that the final result will be the combination of the user - posesor of the account, and all his friends.
My query looks like this:
blog = New.objects.filter(created_by = following,created_by = request.user)
By that ',' i wanted to make a 'join' -i found something like this on a doc- but this method is not correct- i'm getting an error.
How else could be done this 'join' ?
Thanks!