mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Add SVG rendering to cable path tests
This commit is contained in:
@@ -13,6 +13,7 @@ from rest_framework.viewsets import ViewSet
|
||||
|
||||
from circuits.models import Circuit
|
||||
from dcim import filtersets
|
||||
from dcim.constants import CABLE_TRACE_SVG_DEFAULT_WIDTH
|
||||
from dcim.models import *
|
||||
from extras.api.views import ConfigContextQuerySetMixin
|
||||
from ipam.models import Prefix, VLAN
|
||||
@@ -54,9 +55,9 @@ class PathEndpointMixin(object):
|
||||
if request.GET.get('render', None) == 'svg':
|
||||
# Render SVG
|
||||
try:
|
||||
width = min(int(request.GET.get('width')), 1600)
|
||||
width = int(request.GET.get('width', CABLE_TRACE_SVG_DEFAULT_WIDTH))
|
||||
except (ValueError, TypeError):
|
||||
width = None
|
||||
width = CABLE_TRACE_SVG_DEFAULT_WIDTH
|
||||
drawing = obj.get_trace_svg(
|
||||
base_url=request.build_absolute_uri('/'),
|
||||
width=width
|
||||
|
Reference in New Issue
Block a user