DB backend now doesnt attempt to search on callable fields

pull/29/head
Karl Hobley 2014-02-11 14:28:47 +00:00
rodzic f8d2c0bc81
commit cb1a412c3c
1 zmienionych plików z 7 dodań i 0 usunięć

Wyświetl plik

@ -47,6 +47,13 @@ class DBSearch(BaseSearch):
for term in terms:
term_query = None
for field_name in fields:
# Check if the field exists (this will filter out indexed callables)
try:
model._meta.get_field_by_name(field_name)
except:
continue
# Filter on this field
field_filter = {'%s__icontains' % field_name: term}
if term_query is None:
term_query = models.Q(**field_filter)