Django: does the ORM support the SQL "IN" operator?
in
User.objects.filter(id__in=[1, 5, 34, 567, 229])
print _.query
SELECT <fields> FROM "auth_user" WHERE "auth_user"."id" IN (1, 5, 34, 567, 229)
Beside that, Django ORM also support for Sub-Query:
For example:
from django.db.models import Subquery
users = User.objects.all()
UserParent.objects.filter(user_id__in=Subquery(users.values('id')))