소스 검색

Corrected rack height validation to exclude 0U devices

Jeremy Stretch 10 년 전
부모
커밋
7918f85cdd
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      netbox/dcim/models.py

+ 1 - 1
netbox/dcim/models.py

@@ -187,7 +187,7 @@ class Rack(CreatedUpdatedModel):
 
         # Validate that Rack is tall enough to house the installed Devices
         if self.pk:
-            top_device = Device.objects.filter(rack=self).order_by('-position').first()
+            top_device = Device.objects.filter(rack=self).exclude(position__isnull=True).order_by('-position').first()
             if top_device:
                 min_height = top_device.position + top_device.device_type.u_height - 1
                 if self.u_height < min_height: