mirror of
https://github.com/evennia/evennia.git
synced 2026-03-30 04:27:16 +02:00
Optimized Scripts admin page. Fixed related name for objects on attributes.
Repaired search. Removed some backwards compatible parts of picklefield since we aren't supporting version older than 1.5 and they were obscuring the true cause of some issues.
This commit is contained in:
parent
699f86273b
commit
427dcc3985
4 changed files with 17 additions and 20 deletions
|
|
@ -1,6 +1,7 @@
|
|||
"""
|
||||
Custom manager for Objects.
|
||||
"""
|
||||
from itertools import chain
|
||||
from django.db.models import Q
|
||||
from django.conf import settings
|
||||
from django.db.models.fields import exceptions
|
||||
|
|
@ -117,16 +118,16 @@ class ObjectManager(TypedObjectManager):
|
|||
#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))
|
||||
#else:
|
||||
# # We have to loop for safety since the referenced lookup gives deepcopy error if attribute value is an object.
|
||||
# global _ATTR
|
||||
# if not _ATTR:
|
||||
# from src.typeclasses.models import Attribute as _ATTR
|
||||
# cands = list(self.filter(cand_restriction & type_restriction & Q(objattribute__db_key=attribute_name)))
|
||||
# return [_ATTR.
|
||||
# return [_GA(attr, "db_obj") for attr in _OBJATTR.objects.filter(db_obj__in=cands, db_value=attribute_value)]
|
||||
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))
|
||||
else:
|
||||
# We have to loop for safety since the referenced lookup gives deepcopy error if attribute value is an object.
|
||||
global _ATTR
|
||||
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)]
|
||||
return chain(*results)
|
||||
|
||||
@returns_typeclass_list
|
||||
def get_objs_with_db_property(self, property_name, candidates=None):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue