Skip to content

Commit

Permalink
Fix AdministrativeDivision geometry serialization in search
Browse files Browse the repository at this point in the history
  • Loading branch information
japauliina committed Aug 9, 2024
1 parent c428efd commit 577bd9e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion services/search/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,12 @@ def to_representation(self, obj):

if self.context["geometry"]:
if hasattr(obj, "geometry"):
if isinstance(obj, AdministrativeDivision):
geometry = obj.geometry.boundary
else:
geometry = obj.geometry
representation["geometry"] = munigeo_api.geom_to_json(
obj.geometry, DEFAULT_SRS
geometry, DEFAULT_SRS
)
else:
representation["geometry"] = None
Expand Down

0 comments on commit 577bd9e

Please sign in to comment.