Say we have a dvd
table where we want to search for price=14.99
and rating=18
. We could do:
#Making some dictionary
dict1 = {}
#Adding some stuff
dict1['price']=14.99
dict1['rating']18
#Use dict as filter
dvd.objects.filter(**dict1)
Is there a way to add on extra parameters like:
dvd.objects.filter(title__icontains='the')
I'd just like to add a bit more flexibility for the user because at present they can choose what fields they'd like to search in and specify exactly what it is they want. However I'd like to search partial matches, like what __icontains
does. I'd also like __gt
, __lt
.
Is this possible?