I have this query:
search = request.GET['q']
Entries = Entry.objects.filter(Q(field1__icontains=search), Q(field2__icontains=search), Q(field3__icontains=search))
Is there an elegant way to make this cleaner? (I mean make somthing generic like Q(var_field__icontains=search)
and the var_field
will be retrived from a requested post that is one of these values field1, field2, field3).