Reputation: 51211
name = ['a','b'] # Hard coded list
customers = Customer.objects.filter(name=[]) # Want to filter by that list.
How to write such a query?
Upvotes: 0
Views: 95
Reputation: 7418
Customer.objects.filter(name__in=['a', 'b', 'c'])
http://docs.djangoproject.com/en/dev/ref/models/querysets/#in
Upvotes: 4