From f3d9c4e6cafdaca64a5c32fb46615630d8cebe28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laura=20Kl=C3=BCnder?= Date: Tue, 3 Dec 2024 15:22:16 +0100 Subject: [PATCH] implement groups_by_category and groups for old serializing correctly --- src/c3nav/mapdata/models/locations.py | 3 ++- src/c3nav/mapdata/schemas/models.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/c3nav/mapdata/models/locations.py b/src/c3nav/mapdata/models/locations.py index ef87ffa1..5c133d87 100644 --- a/src/c3nav/mapdata/models/locations.py +++ b/src/c3nav/mapdata/models/locations.py @@ -195,7 +195,8 @@ class SpecificLocation(Location, models.Model): if grid_square is not None: result['grid_square'] = grid_square or None if detailed: - result['groups'] = self.groups_by_category + result["groups"] = [g.pk for g in self.groups.all()] + result['groups_by_category'] = self.groups_by_category result["label_settings"] = self.label_settings_id effective_label_settings = self.effective_label_settings diff --git a/src/c3nav/mapdata/schemas/models.py b/src/c3nav/mapdata/schemas/models.py index 6aeb9566..3a19bbb9 100644 --- a/src/c3nav/mapdata/schemas/models.py +++ b/src/c3nav/mapdata/schemas/models.py @@ -577,6 +577,7 @@ class SlimLocationMixin(BaseSchema): can_search: ClassVar[None] can_describe: ClassVar[None] groups: ClassVar[None] + groups_by_category: ClassVar[None] class SlimLevelLocationSchema(SlimLocationMixin, FullLevelLocationSchema):