[Answered ]-Get null or empty query set in django

2👍

You can get an empty queryset with none():

MyModel.objects.none()

An alternative approach is to or the Q() objects together instead of querysets:

q = Q()
for term in key.split():
    q = q | Q(fName__icontains=term) | Q(lName__icontains=term)
return customer_info.objects.filter(q)

Leave a comment