Update/refactor search_channel with aliases and proper query. Resolves #1534.
This commit is contained in:
parent
e3de3fb1dc
commit
d2b89b7613
2 changed files with 31 additions and 32 deletions
|
|
@ -76,10 +76,14 @@ class ObjectDBManager(TypedObjectManager):
|
|||
# simplest case - search by dbref
|
||||
dbref = self.dbref(ostring)
|
||||
if dbref:
|
||||
return dbref
|
||||
try:
|
||||
return self.get(id=dbref)
|
||||
except self.model.DoesNotExist:
|
||||
pass
|
||||
|
||||
# not a dbref. Search by name.
|
||||
cand_restriction = candidates is not None and Q(pk__in=[_GA(obj, "id") for obj in make_iter(candidates)
|
||||
if obj]) or Q()
|
||||
cand_restriction = candidates is not None and Q(
|
||||
pk__in=[_GA(obj, "id") for obj in make_iter(candidates) if obj]) or Q()
|
||||
if exact:
|
||||
return self.filter(cand_restriction & Q(db_account__username__iexact=ostring))
|
||||
else: # fuzzy matching
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue