1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

review updates to svg rendering

This commit is contained in:
John Anderson
2019-12-11 13:39:10 -05:00
parent c09aefd509
commit 7f788eaa06
7 changed files with 137 additions and 109 deletions

View File

@@ -219,17 +219,17 @@ class RackViewSet(CustomFieldModelViewSet):
data = serializer.validated_data
if data['render_format'] == 'svg':
drawing = rack.get_elevation_svg(data['face'], data['width'], data['unit_height'])
# Render and return the elevation as an SVG drawing with the correct content type
drawing = rack.get_elevation_svg(data['face'], data['unit_width'], data['unit_height'])
return HttpResponse(drawing.tostring(), content_type='image/svg+xml')
else:
# Return a JSON representation of the rack units in the elevation
elevation = rack.get_rack_units(
face=data['face'],
exclude=data['exclude'],
expand_devices=data['expand_devices']
)
if data['q']:
elevation = [u for u in elevation if data['q'] in str(u['id'])]
page = self.paginate_queryset(elevation)
if page is not None: