only show neighbor spaces with normal level

This commit is contained in:
Laura Klünder 2017-05-21 23:55:12 +02:00
parent f42d4dbeaf
commit b256760d12

View file

@ -58,21 +58,20 @@ class EditorViewSet(ViewSet):
doors = [door for door in section.doors.all() if door.geometry.intersects(space.geometry)]
doors_geom = cascaded_union([door.geometry for door in doors])
spaces = [space for space in section.spaces.all() if space.geometry.intersects(doors_geom)]
spaces = [s for s in section.spaces.filter(level='')
if s.geometry.intersects(doors_geom) and s.pk != space.pk]
results = []
results.extend(section.buildings.all())
results.extend(doors)
results.extend(spaces)
results.extend(chain(
results = chain(
section.buildings.all(),
doors,
spaces,
[space],
space.areas.all(),
space.stairs.all(),
space.obstacles.all(),
space.lineobstacles.all(),
space.points.all(),
))
)
return Response([obj.to_geojson() for obj in results])
else:
raise ValidationError('No section or space specified.')