Manager.py is returning a couple of querysets instead of lists. Fix for bug #2088
This commit is contained in:
parent
8d3253b966
commit
7a428b703b
1 changed files with 4 additions and 4 deletions
|
|
@ -178,11 +178,11 @@ class ObjectDBManager(TypedObjectManager):
|
||||||
# This doesn't work if attribute_value is an object. Workaround below
|
# This doesn't work if attribute_value is an object. Workaround below
|
||||||
|
|
||||||
if isinstance(attribute_value, (str, int, float, bool)):
|
if isinstance(attribute_value, (str, int, float, bool)):
|
||||||
return self.filter(
|
return list(self.filter(
|
||||||
cand_restriction
|
cand_restriction
|
||||||
& type_restriction
|
& type_restriction
|
||||||
& Q(db_attributes__db_key=attribute_name, db_attributes__db_value=attribute_value)
|
& Q(db_attributes__db_key=attribute_name, db_attributes__db_value=attribute_value)
|
||||||
).order_by("id")
|
).order_by("id"))
|
||||||
else:
|
else:
|
||||||
# We must loop for safety since the referenced lookup gives deepcopy error if attribute value is an object.
|
# We must loop for safety since the referenced lookup gives deepcopy error if attribute value is an object.
|
||||||
global _ATTR
|
global _ATTR
|
||||||
|
|
@ -278,7 +278,7 @@ class ObjectDBManager(TypedObjectManager):
|
||||||
exclude_restriction = (
|
exclude_restriction = (
|
||||||
Q(pk__in=[_GA(obj, "id") for obj in make_iter(excludeobj)]) if excludeobj else Q()
|
Q(pk__in=[_GA(obj, "id") for obj in make_iter(excludeobj)]) if excludeobj else Q()
|
||||||
)
|
)
|
||||||
return self.filter(db_location=location).exclude(exclude_restriction).order_by("id")
|
return list(self.filter(db_location=location).exclude(exclude_restriction).order_by("id"))
|
||||||
|
|
||||||
def get_objs_with_key_or_alias(self, ostring, exact=True, candidates=None, typeclasses=None):
|
def get_objs_with_key_or_alias(self, ostring, exact=True, candidates=None, typeclasses=None):
|
||||||
"""
|
"""
|
||||||
|
|
@ -309,7 +309,7 @@ class ObjectDBManager(TypedObjectManager):
|
||||||
type_restriction = typeclasses and Q(db_typeclass_path__in=make_iter(typeclasses)) or Q()
|
type_restriction = typeclasses and Q(db_typeclass_path__in=make_iter(typeclasses)) or Q()
|
||||||
if exact:
|
if exact:
|
||||||
# exact match - do direct search
|
# exact match - do direct search
|
||||||
return (
|
return list(
|
||||||
(
|
(
|
||||||
self.filter(
|
self.filter(
|
||||||
cand_restriction
|
cand_restriction
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue