Make search_account also search by account alias. Resolve #1910
This commit is contained in:
parent
a35dcedcc0
commit
ad2e0ce0be
1 changed files with 9 additions and 2 deletions
|
|
@ -169,9 +169,16 @@ class AccountDBManager(TypedObjectManager, UserManager):
|
||||||
typeclass = "%s" % typeclass
|
typeclass = "%s" % typeclass
|
||||||
query["db_typeclass_path"] = typeclass
|
query["db_typeclass_path"] = typeclass
|
||||||
if exact:
|
if exact:
|
||||||
return self.filter(**query)
|
matches = self.filter(**query)
|
||||||
else:
|
else:
|
||||||
return self.filter(**query)
|
matches = self.filter(**query)
|
||||||
|
if not matches:
|
||||||
|
# try alias match
|
||||||
|
matches = self.filter(
|
||||||
|
db_tags__db_tagtype__iexact="alias",
|
||||||
|
**{"db_tags__db_key__iexact" if exact else "db_tags__db_key__icontains": ostring})
|
||||||
|
return matches
|
||||||
|
|
||||||
# back-compatibility alias
|
# back-compatibility alias
|
||||||
account_search = search_account
|
account_search = search_account
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue