add location→types API endpoint

This commit is contained in:
Laura Klünder 2017-05-11 21:30:29 +02:00
parent 6bbac4a7ba
commit 40375585e1
3 changed files with 32 additions and 17 deletions

View file

@ -30,6 +30,13 @@ class GeometryMixin(EditorFormMixin):
('geometry', format_geojson(mapping(self.geometry), round=False)),
))
@classmethod
def serialize_type(cls, geomtype=True, **kwargs):
result = super().serialize_type()
if geomtype:
result['geomtype'] = cls._meta.get_field('geometry').geomtype
return result
def serialize(self, geometry=True, **kwargs):
result = super().serialize(geometry=geometry, **kwargs)
if geometry: