from django.db.models import Q
def find_user_by_name(query_name):
qs = User.objects.all()
for term in query_name.split():
qs = qs.filter( Q(first_name__icontains = term) | Q(last_name__icontains = term))
return qs
SELECT * FROM table
WHERE last_name = 'ФАМИЛИЯ' AND firt_name= 'ИМЯ'
SELECT * FROM table
WHERE concat(last_name, ' ', firt_name) = 'ФАМИЛИЯ ИМЯ'
SELECT * FROM table
WHERE lower(concat(last_name, ' ', firt_name)) = lower('ФАМИЛИЯ ИМЯ')