remove ordereddict for performance reasons

This commit is contained in:
Laura Klünder 2018-12-27 16:07:07 +01:00
parent 3f2fb2cf69
commit 8ea8f59d99
2 changed files with 2 additions and 3 deletions

View file

@ -27,7 +27,7 @@ class SerializableMixin(models.Model):
))
def _serialize(self, include_type=False, **kwargs):
result = OrderedDict()
result = {}
if include_type:
result['type'] = self.__class__.__name__.lower()
result['id'] = self.pk

View file

@ -1,4 +1,3 @@
from collections import OrderedDict
from contextlib import suppress
from operator import attrgetter
@ -105,7 +104,7 @@ class Location(LocationSlug, AccessRestrictionMixin, TitledMixin, models.Model):
if not detailed:
fields = ('id', 'type', 'slug', 'title', 'subtitle', 'icon', 'point', 'bounds', 'grid_square',
'locations', 'on_top_of')
result = OrderedDict(((name, result[name]) for name in fields if name in result))
result = {name: result[name] for name in fields if name in result}
return result
def _serialize(self, **kwargs):