show locations immediately after searching

This commit is contained in:
Laura Klünder 2018-12-25 18:08:33 +01:00
parent 9a9ea45242
commit 95fce11d00
3 changed files with 31 additions and 6 deletions

View file

@ -359,9 +359,13 @@ class LocationViewSetBase(RetrieveModelMixin, GenericViewSet):
if isinstance(location, LocationRedirect):
return redirect('../' + str(location.target.pk) + '/geometry/')
return Response(location.get_geometry(
detailed_geometry=MapdataViewSet.can_access_geometry(request, location),
))
return Response({
'id': location.id,
'level': getattr(location, 'level_id', None),
'geometry': location.get_geometry(
detailed_geometry=MapdataViewSet.can_access_geometry(request, location)
)
})
class LocationViewSet(LocationViewSetBase):

View file

@ -348,6 +348,9 @@ class CustomLocation:
result['display'].pop(6)
return result
def get_geometry(self, detailed_geometry=True):
return None
@cached_property
def description(self):
from c3nav.routing.router import Router