Просмотр исходного кода

Fix bug with rendering devices taller than 1U

Jeremy Stretch 6 лет назад
Родитель
Сommit
dbf9a2b452
1 измененных файлов с 4 добавлено и 4 удалено
  1. 4 4
      netbox/dcim/models.py

+ 4 - 4
netbox/dcim/models.py

@@ -525,17 +525,17 @@ class RackElevationHelperMixin:
         link.add(drawing.text("add device", insert=text, class_='add-device'))
         link.add(drawing.text("add device", insert=text, class_='add-device'))
 
 
     def _draw_elevations(self, elevation, reserved_units, face, unit_width, unit_height):
     def _draw_elevations(self, elevation, reserved_units, face, unit_width, unit_height):
+
         drawing = self._setup_drawing(unit_width, unit_height * self.u_height)
         drawing = self._setup_drawing(unit_width, unit_height * self.u_height)
 
 
         unit_cursor = 0
         unit_cursor = 0
-        total_units = len(elevation)
-        while unit_cursor < total_units:
+        for unit in elevation:
+
             # Loop through all units in the elevation
             # Loop through all units in the elevation
-            unit = elevation[unit_cursor]
             device = unit['device']
             device = unit['device']
             height = unit.get('height', 1)
             height = unit.get('height', 1)
 
 
-            # Setup drawing cordinates
+            # Setup drawing coordinates
             start_y = unit_cursor * unit_height
             start_y = unit_cursor * unit_height
             end_y = unit_height * height
             end_y = unit_height * height
             start_cordinates = (0, start_y)
             start_cordinates = (0, start_y)