I have a problem passing arguments through a list to Django filter. Here my code:
args = [ "Q( title__icontains = 'Foo' ) | Q( author__icontains = 'Foo' )", "Q( title__icontains = 'Bar' ) | Q( author__icontains = 'Bar' )" ]
entries = Book.objects.filter( *args )
but filter
returns this error:
ValueError: too many values to unpack,
Your args are strings, but they must be
Q
objects. Remove the quotes around yourQ
object definitions.