Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

django queryset with multiple contain keyword

final_pred = Q()
   for pred in [Q(name__icontains=keyword) for keyword in keywords.split(' ')]:
     final_pred = final_pred | pred;
   Table.objects.filter(final_pre)
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #django #queryset #multiple #keyword
ADD COMMENT
Topic
Name
8+7 =