mirror of
https://github.com/netbox-community/netbox.git
synced 2026-01-08 21:02:18 -06:00
change render_format to render for svg elevations
This commit is contained in:
@@ -176,9 +176,9 @@ class RackElevationDetailFilterSerializer(serializers.Serializer):
|
||||
choices=DeviceFaceChoices,
|
||||
default=DeviceFaceChoices.FACE_FRONT
|
||||
)
|
||||
render_format = serializers.ChoiceField(
|
||||
choices=RackElevationDetailRenderFormatChoices,
|
||||
default=RackElevationDetailRenderFormatChoices.RENDER_FORMAT_JSON
|
||||
render = serializers.ChoiceField(
|
||||
choices=RackElevationDetailRenderChoices,
|
||||
default=RackElevationDetailRenderChoices.RENDER_JSON
|
||||
)
|
||||
unit_width = serializers.IntegerField(
|
||||
default=RACK_ELEVATION_UNIT_WIDTH_DEFAULT
|
||||
|
||||
@@ -218,7 +218,7 @@ class RackViewSet(CustomFieldModelViewSet):
|
||||
return Response(serializer.errors, 400)
|
||||
data = serializer.validated_data
|
||||
|
||||
if data['render_format'] == 'svg':
|
||||
if data['render'] == 'svg':
|
||||
# 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')
|
||||
|
||||
@@ -105,14 +105,14 @@ class RackDimensionUnitChoices(ChoiceSet):
|
||||
}
|
||||
|
||||
|
||||
class RackElevationDetailRenderFormatChoices(ChoiceSet):
|
||||
class RackElevationDetailRenderChoices(ChoiceSet):
|
||||
|
||||
RENDER_FORMAT_JSON = 'json'
|
||||
RENDER_FORMAT_SVG = 'svg'
|
||||
RENDER_JSON = 'json'
|
||||
RENDER_SVG = 'svg'
|
||||
|
||||
CHOICES = (
|
||||
(RENDER_FORMAT_JSON, 'json'),
|
||||
(RENDER_FORMAT_SVG, 'svg')
|
||||
(RENDER_JSON, 'json'),
|
||||
(RENDER_SVG, 'svg')
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user