Homogenize manager search methods to return querysets. Resolve #2384.

This commit is contained in:
Griatch 2022-01-09 17:13:24 +01:00
parent 01af303457
commit 9c0b44e13a
7 changed files with 65 additions and 39 deletions

View file

@ -237,7 +237,7 @@ class MsgManager(TypedObjectManager):
always gives only one match.
Returns:
Queryset: Message matches.
Queryset: Iterable with 0, 1 or more matches.
"""
# unique msg id
@ -420,13 +420,16 @@ class ChannelDBManager(TypedObjectManager):
exact (bool, optional): Require an exact (but not
case sensitive) match.
Returns:
Queryset: Iterable with 0, 1 or more matches.
"""
dbref = self.dbref(ostring)
if dbref:
try:
return [self.get(id=dbref)]
except self.model.DoesNotExist:
pass
dbref_match = self.search_dbref(dbref)
if dbref_match:
return dbref_match
if exact:
channels = self.filter(
Q(db_key__iexact=ostring)