I have an array of values
values['value1','value2'....n]
I want to perform the following query
res = TheModel.objects.filter(key=values[0] or key = values[1] or key = values[2]...n)
Here the problem is array size may be different every time. How can I achieve this?
CodePudding user response:
You can use __in
filter:
res = TheModel.objects.filter(key__in=values)