Reputation: 577
When I want to exclude some data row, I used to use:
entry.object.filter(name__startwith='Tom').exclude(name='foo')
I want to give exclude conditions like below. Is it possible?
entry.object.filter(name__startwith='Tom').exclude(name=['bar','foo'])
Could you give me some solutions?
Upvotes: 0
Views: 1223
Reputation: 6488
To check if name
is included in a list, use __in
:
entry.object.filter(name__startwith='Tom').exclude(name__in=['bar','foo'])
Upvotes: 6