This commit is contained in:
Laura Klünder 2017-10-10 17:55:55 +02:00
parent c3cb12d2bc
commit ead6de24ae
2 changed files with 17 additions and 3 deletions

View file

@ -10,7 +10,7 @@ from rest_framework.decorators import detail_route, list_route
from rest_framework.exceptions import NotFound, ValidationError
from rest_framework.mixins import RetrieveModelMixin
from rest_framework.response import Response
from rest_framework.viewsets import GenericViewSet, ReadOnlyModelViewSet
from rest_framework.viewsets import GenericViewSet, ReadOnlyModelViewSet, ViewSet
from c3nav.mapdata.models import AccessRestriction, Building, Door, Hole, LocationGroup, Source, Space
from c3nav.mapdata.models.geometry.level import LevelGeometryMixin
@ -28,6 +28,19 @@ def optimize_query(qs):
return qs
class MapViewSet(ViewSet):
"""
Map API
/bounds/ returns the maximum bounds of the map
"""
@list_route(methods=['get'])
def bounds(self, request, *args, **kwargs):
return Response({
'bounds': Source.max_bounds(),
})
class MapdataViewSet(ReadOnlyModelViewSet):
def get_queryset(self):
qs = super().get_queryset()