maps = (maps.filter(name__icontains=search_terms) |
maps.filter(description__icontains=search_terms))
i can't find this filter .
thanks
maps = (maps.filter(name__icontains=search_terms) |
maps.filter(description__icontains=search_terms))
i can't find this filter .
thanks
xxx_icontains
searches the whole xxx
field for the argument, case-insensitively.
http://docs.djangoproject.com/en/1.1/ref/models/querysets/#icontains
It's a case-insensitive containment test.
Example:
Entry.objects.get(headline__icontains='Lennon')
SQL equivalent:
SELECT ... WHERE headline ILIKE '%Lennon%';
In your case the code says maps should be True if either the name or the description field contains the value of search_terms.