views:

53

answers:

2
maps = (maps.filter(name__icontains=search_terms) |
            maps.filter(description__icontains=search_terms))

i can't find this filter .

thanks

+1  A: 

xxx_icontains searches the whole xxx field for the argument, case-insensitively.

http://docs.djangoproject.com/en/1.1/ref/models/querysets/#icontains

vicvicvic
+3  A: 

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.

Garethr