better api output
This commit is contained in:
parent
4bde1e4e1b
commit
f785349141
1 changed files with 21 additions and 0 deletions
|
@ -256,6 +256,9 @@ class CustomLocation:
|
||||||
('subtitle', self.subtitle),
|
('subtitle', self.subtitle),
|
||||||
('level', self.level.pk),
|
('level', self.level.pk),
|
||||||
('space', self.space.pk if self.space else None),
|
('space', self.space.pk if self.space else None),
|
||||||
|
('areas', tuple(area.pk for area in self.areas)),
|
||||||
|
('near_area', self.near_area.pk if self.near_area else None),
|
||||||
|
('near_poi', self.near_poi.pk if self.near_poi else None),
|
||||||
('altitude', None if self.altitude is None else round(self.altitude, 2))
|
('altitude', None if self.altitude is None else round(self.altitude, 2))
|
||||||
))
|
))
|
||||||
if include_type:
|
if include_type:
|
||||||
|
@ -289,6 +292,24 @@ class CustomLocation:
|
||||||
'title': self.space.title,
|
'title': self.space.title,
|
||||||
'can_search': self.space.can_search,
|
'can_search': self.space.can_search,
|
||||||
} if self.space else None),
|
} if self.space else None),
|
||||||
|
(_('Areas'), tuple({
|
||||||
|
'id': area.pk,
|
||||||
|
'slug': area.get_slug(),
|
||||||
|
'title': area.title,
|
||||||
|
'can_search': area.can_search,
|
||||||
|
} for area in self.areas)),
|
||||||
|
(_('Near Area'), {
|
||||||
|
'id': self.near_area.pk,
|
||||||
|
'slug': self.near_area.get_slug(),
|
||||||
|
'title': self.near_area.title,
|
||||||
|
'can_search': self.near_area.can_search,
|
||||||
|
} if self.near_area else None),
|
||||||
|
(_('Near POI'), {
|
||||||
|
'id': self.near_poi.pk,
|
||||||
|
'slug': self.near_poi.get_slug(),
|
||||||
|
'title': self.near_poi.title,
|
||||||
|
'can_search': self.near_poi.can_search,
|
||||||
|
} if self.near_poi else None),
|
||||||
(_('X Coordinate'), str(self.x)),
|
(_('X Coordinate'), str(self.x)),
|
||||||
(_('Y Coordinate'), str(self.y)),
|
(_('Y Coordinate'), str(self.y)),
|
||||||
(_('Altitude'), None if self.altitude is None else str(round(self.altitude, 2))),
|
(_('Altitude'), None if self.altitude is None else str(round(self.altitude, 2))),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue