I am new to django and trying to filter multiple fields that contain text.
columns = ['ticketId', 'checkSum']
q_objects = [Q(fieldname +'__contains', myString) for fieldname in columns]
objects = objects.filter(reduce(operator.or_, q_objects))
I get Exception Type: ValueError Exception Value: too many values to unpack on the "filter" last line. Any ideas
Q
object instantiation doesn't look right. It should beQ(**{fieldname +'__contains': myString})
- passing it two separate arguments as you are doing will not work. - solarissmoke