Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

or operator in django queryset

from django.db.models import Q

Contact.objects.filter(Q(last_name__icontains=request.POST['query']) | 
                               Q(first_name__icontains=request.POST['query']))
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #operator #django #queryset
ADD COMMENT
Topic
Name
4+9 =