I'm trying to use an OR
operator in the Django filter()
function. Right now I have
contactlist = Contact.objects.filter(last_name__icontains=request.POST['query'])
but I also want to search by first name as well. For example:
contactlist = Contact.objects.filter(last_name__icontains=request.POST['query'] OR first_name__icontains=request.POST['query'])
Does anyone know how to do this?
Q objects