remove ordereddict for performance reasons
This commit is contained in:
parent
3f2fb2cf69
commit
8ea8f59d99
2 changed files with 2 additions and 3 deletions
|
@ -27,7 +27,7 @@ class SerializableMixin(models.Model):
|
||||||
))
|
))
|
||||||
|
|
||||||
def _serialize(self, include_type=False, **kwargs):
|
def _serialize(self, include_type=False, **kwargs):
|
||||||
result = OrderedDict()
|
result = {}
|
||||||
if include_type:
|
if include_type:
|
||||||
result['type'] = self.__class__.__name__.lower()
|
result['type'] = self.__class__.__name__.lower()
|
||||||
result['id'] = self.pk
|
result['id'] = self.pk
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
from collections import OrderedDict
|
|
||||||
from contextlib import suppress
|
from contextlib import suppress
|
||||||
from operator import attrgetter
|
from operator import attrgetter
|
||||||
|
|
||||||
|
@ -105,7 +104,7 @@ class Location(LocationSlug, AccessRestrictionMixin, TitledMixin, models.Model):
|
||||||
if not detailed:
|
if not detailed:
|
||||||
fields = ('id', 'type', 'slug', 'title', 'subtitle', 'icon', 'point', 'bounds', 'grid_square',
|
fields = ('id', 'type', 'slug', 'title', 'subtitle', 'icon', 'point', 'bounds', 'grid_square',
|
||||||
'locations', 'on_top_of')
|
'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
|
return result
|
||||||
|
|
||||||
def _serialize(self, **kwargs):
|
def _serialize(self, **kwargs):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue