1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #2192: Prevent a 0U device from being assigned to a rack position

This commit is contained in:
Jeremy Stretch
2018-06-29 14:09:20 -04:00
parent 982b9454f8
commit 8d4c686ae2

View File

@@ -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: