Fixed a bug in exact search pattern matching.

This commit is contained in:
Griatch 2012-09-27 21:29:01 +02:00
parent 60e3f5f172
commit 59ccd3eb38
3 changed files with 115 additions and 116 deletions

View file

@ -178,7 +178,7 @@ class ObjectManager(TypedObjectManager):
candidates_id = [_GA(obj, "id") for obj in make_iter(candidates) if obj]
cand_restriction = candidates and Q(pk__in=candidates_id) or Q()
if exact:
return self.filter(cand_restriction & (Q(db_key__iexact=ostring) | Q(alias__db_key__iexact=ostring)))
return self.filter(cand_restriction & (Q(db_key__iexact=ostring) | Q(alias__db_key__iexact=ostring))).distinct()
else:
if candidates:
# fuzzy matching - only check the candidates
@ -209,7 +209,6 @@ class ObjectManager(TypedObjectManager):
@returns_typeclass_list
def object_search(self, ostring, caller=None,
global_search=False,
attribute_name=None,
candidates=None,
exact=True):