diff --git a/evennia/prototypes/prototypes.py b/evennia/prototypes/prototypes.py index c0e5088deb..54d7ca84fb 100644 --- a/evennia/prototypes/prototypes.py +++ b/evennia/prototypes/prototypes.py @@ -319,10 +319,11 @@ def search_prototype(key=None, tags=None, require_single=False): tag_categories = ["db_prototype" for _ in tags] db_matches = DbPrototype.objects.get_by_tag(tags, tag_categories) else: - db_matches = DbPrototype.objects.all() + db_matches = DbPrototype.objects.all().order_by("id") if key: # exact or partial match on key - db_matches = db_matches.filter(db_key=key) or db_matches.filter(db_key__icontains=key) + db_matches = (db_matches.filter(db_key=key) or + db_matches.filter(db_key__icontains=key)).order_by("id") # return prototype db_prototypes = [dbprot.prototype for dbprot in db_matches] diff --git a/evennia/typeclasses/managers.py b/evennia/typeclasses/managers.py index a76ff2384f..062ce0f5e3 100644 --- a/evennia/typeclasses/managers.py +++ b/evennia/typeclasses/managers.py @@ -260,7 +260,7 @@ class TypedObjectManager(idmapper.manager.SharedMemoryManager): dbmodel = self.model.__dbclass__.__name__.lower() query = self.filter(db_tags__db_tagtype__iexact=tagtype, - db_tags__db_model__iexact=dbmodel).distinct() + db_tags__db_model__iexact=dbmodel).distinct().order_by('id') if n_keys > 0: # keys and/or categories given