diff --git a/src/objects/manager.py b/src/objects/manager.py index fae02e6a00..901d6fa7cd 100644 --- a/src/objects/manager.py +++ b/src/objects/manager.py @@ -115,8 +115,6 @@ class ObjectManager(TypedObjectManager): type_restriction = typeclasses and Q(db_typeclass_path__in=make_iter(typeclasses)) or Q() ## This doesn't work if attribute_value is an object. Workaround below - #q = self.filter(cand_restriction & type_restriction & Q(objattribute__db_key=attribute_name) & Q(objattribute__db_value=attribute_value)) - #return list(q) if isinstance(attribute_value, (basestring, int, float, bool, long)): return self.filter(cand_restriction & type_restriction & Q(db_attributes__db_key=attribute_name, db_attributes__db_value=attribute_value)) @@ -126,7 +124,7 @@ class ObjectManager(TypedObjectManager): if not _ATTR: from src.typeclasses.models import Attribute as _ATTR cands = list(self.filter(cand_restriction & type_restriction & Q(db_attributes__db_key=attribute_name))) - results = [attr.db_objects.all() for attr in _ATTR.objects.filter(db_objects__in=cands, db_value=attribute_value)] + results = [attr.objectdb_set.all() for attr in _ATTR.objects.filter(objectdb__in=cands, db_value=attribute_value)] return chain(*results) @returns_typeclass_list diff --git a/src/typeclasses/models.py b/src/typeclasses/models.py index e3ad91f99b..1d3c1daa28 100644 --- a/src/typeclasses/models.py +++ b/src/typeclasses/models.py @@ -596,8 +596,7 @@ class TypedObject(SharedMemoryModel): help_text="locks limit access to an entity. A lock is defined as a 'lock string' on the form 'type:lockfunctions', defining what functionality is locked and how to determine access. Not defining a lock means no access is granted.") # many2many relationships db_attributes = models.ManyToManyField(Attribute, null=True, - help_text='attributes on this object. An attribute can hold any pickle-able python object (see docs for special cases).', - related_name='db_objects') + help_text='attributes on this object. An attribute can hold any pickle-able python object (see docs for special cases).') db_liteattributes = models.ManyToManyField(LiteAttribute, null=True, help_text='liteattributes on this object. A LiteAttribute holds a key, a category and a string field for simple lookups.') db_tags = models.ManyToManyField(Tag, null=True,