[Answer]-Iterate through a list and use values in complex queries Django ORM

1👍

from operator import or_
val = MyModel.objects.filter(reduce(or_,(Q(item__startswith=x) for x in searchQuery)))

Use reduce to combine a generated sequence of Q expressions.

👤MattH

Leave a comment