- q = Q(**{"%s__icontains" % filter_fields[0]: value})
- for field in filter_fields[1:]:
- q |= Q(**{"%s__icontains" % field: value})
- return qs.filter(q)
+
+ for word in value.split():
+ m = re.match(r'(.+):(.+)', word)
+ if m is not None:
+ field = m.group(1)
+ value = m.group(2)
+ q = Book.q_dc(field, field + 's', value, 'book__')
+ else:
+ q = Q(**{"%s__icontains" % filter_fields[0]: value})
+ for field in filter_fields[1:]:
+ q |= Q(**{"%s__icontains" % field: value})
+ qs = qs.filter(q)
+
+ return qs