From 8d4c686ae2b5d1c82dd87e4aa645546c65719e2b Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 29 Jun 2018 14:09:20 -0400 Subject: [PATCH] Fixes #2192: Prevent a 0U device from being assigned to a rack position --- netbox/dcim/models.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index 39bd4ad3d..95e9299b8 100644 --- a/netbox/dcim/models.py +++ b/netbox/dcim/models.py @@ -963,6 +963,12 @@ class Device(CreatedUpdatedModel, CustomFieldModel): 'face': "Must specify rack face when defining rack position.", }) + # Prevent 0U devices from being assigned to a specific position + if self.position and self.device_type.u_height == 0: + raise ValidationError({ + 'position': "A U0 device type ({}) cannot be assigned to a rack position.".format(self.device_type) + }) + if self.rack: try: