add simple_api_cache to editor API
This commit is contained in:
parent
9dafd3f777
commit
7632ce39ae
2 changed files with 8 additions and 3 deletions
|
@ -9,7 +9,9 @@ from rest_framework.viewsets import ReadOnlyModelViewSet, ViewSet
|
|||
from shapely.ops import cascaded_union
|
||||
|
||||
from c3nav.editor.models import ChangeSet
|
||||
from c3nav.mapdata.models import Area, Door, Source
|
||||
from c3nav.editor.views.base import etag_func
|
||||
from c3nav.mapdata.api import simple_api_cache
|
||||
from c3nav.mapdata.models import Area, Door, MapUpdate, Source
|
||||
from c3nav.mapdata.models.geometry.space import POI
|
||||
|
||||
|
||||
|
@ -67,6 +69,7 @@ class EditorViewSet(ViewSet):
|
|||
|
||||
# noinspection PyPep8Naming
|
||||
@list_route(methods=['get'])
|
||||
@simple_api_cache(etag_func)
|
||||
def geometries(self, request, *args, **kwargs):
|
||||
request.changeset = ChangeSet.get_for_request(request)
|
||||
|
||||
|
@ -189,6 +192,7 @@ class EditorViewSet(ViewSet):
|
|||
raise ValidationError('No level or space specified.')
|
||||
|
||||
@list_route(methods=['get'])
|
||||
@simple_api_cache(MapUpdate.current_cache_key)
|
||||
def geometrystyles(self, request, *args, **kwargs):
|
||||
return Response({
|
||||
'building': '#aaaaaa',
|
||||
|
@ -208,6 +212,7 @@ class EditorViewSet(ViewSet):
|
|||
})
|
||||
|
||||
@list_route(methods=['get'])
|
||||
@simple_api_cache(etag_func)
|
||||
def bounds(self, request, *args, **kwargs):
|
||||
return Response({
|
||||
'bounds': Source.max_bounds(),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue