Last active
October 11, 2015 01:48
-
-
Save nigma/3784395 to your computer and use it in GitHub Desktop.
PostgreSQL field type casting in Django subqueries
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
User.objects.filter( | |
pk__in=Follow.objects.filter( | |
user=self.user, | |
content_type=ContentType.objects.get_for_model(User) | |
).extra(select={"user_ids": "object_id::integer"}).values_list("user_ids") | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment