From 858d6e89dc0d054d9f61012e8aa95aa8da226b6c Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Wed, 11 Dec 2019 20:19:01 -0500 Subject: [PATCH] Fix bug with rendering devices taller than 1U --- netbox/dcim/models.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index 061824968..dd077183c 100644 --- a/netbox/dcim/models.py +++ b/netbox/dcim/models.py @@ -525,17 +525,17 @@ class RackElevationHelperMixin: link.add(drawing.text("add device", insert=text, class_='add-device')) def _draw_elevations(self, elevation, reserved_units, face, unit_width, unit_height): + drawing = self._setup_drawing(unit_width, unit_height * self.u_height) unit_cursor = 0 - total_units = len(elevation) - while unit_cursor < total_units: + for unit in elevation: + # Loop through all units in the elevation - unit = elevation[unit_cursor] device = unit['device'] height = unit.get('height', 1) - # Setup drawing cordinates + # Setup drawing coordinates start_y = unit_cursor * unit_height end_y = unit_height * height start_cordinates = (0, start_y)