Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

django queryset multiple filters

# Will return rows with 1 or 6 in colA and 'yourValue' in colB
YourModel.objects.filter(colA__in=[1,8],colB='yourValue')

# Will return rows with 1 or 6 in colA OR
# potentially different rows with 'yourValue' in colB
YourModel.objects.filter(colA__in=[1,8]).filter(colB='yourValue')
Source by docs.djangoproject.com #
 
PREVIOUS NEXT
Tagged: #django #queryset #multiple #filters
ADD COMMENT
Topic
Name
2+9 =