Created
October 14, 2013 14:51
-
-
Save ShinJJang/abde260e4f40e9962173 to your computer and use it in GitHub Desktop.
django object join exam using foreign key reverse
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Purpose for exact match, but this's Partial matches | |
""" | |
pks = [ "1", "2", "3", "4" ] | |
query = reduce(operator.and_, [ Q(comments__pk=x) for x in pks ] ) | |
bundle.data['answer'] = Posts.objects.filter(query).distinct() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment