From 7918f85cdd0472a37cf8a16d545cb68201d112fb Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 27 Jun 2016 23:08:30 -0400 Subject: [PATCH] Corrected rack height validation to exclude 0U devices --- netbox/dcim/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index 0c587dd3d..b6ec28be2 100644 --- a/netbox/dcim/models.py +++ b/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: