From 1528e667589295e0a45f7940460cd3184091341a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Mon, 10 Dec 2018 19:24:19 +0100 Subject: [PATCH] add cell property to location serialization --- src/c3nav/mapdata/models/locations.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/c3nav/mapdata/models/locations.py b/src/c3nav/mapdata/models/locations.py index c7f0edbc..aaa5a1ac 100644 --- a/src/c3nav/mapdata/models/locations.py +++ b/src/c3nav/mapdata/models/locations.py @@ -85,7 +85,7 @@ class Location(LocationSlug, AccessRestrictionMixin, TitledMixin, models.Model): def serialize(self, detailed=True, describe_only=False, **kwargs): result = super().serialize(detailed=detailed, **kwargs) if not detailed: - fields = ('id', 'type', 'slug', 'title', 'subtitle', 'point', 'bounds', 'locations', 'on_top_of') + fields = ('id', 'type', 'slug', 'title', 'subtitle', 'point', 'bounds', 'locations', 'cell', 'on_top_of') result = OrderedDict(((name, result[name]) for name in fields if name in result)) return result @@ -137,6 +137,9 @@ class SpecificLocation(Location, models.Model): def _serialize(self, detailed=True, **kwargs): result = super()._serialize(detailed=detailed, **kwargs) + grid_cell = self.grid_cell + if grid_cell is not None: + result['cell'] = grid_cell or None if detailed: groups = {} for group in self.groups.all():