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

Fixes #2639: Fix preservation of length/dimensions unit for racks and cables

This commit is contained in:
Jeremy Stretch
2018-12-03 11:13:37 -05:00
parent d1cd366dc9
commit a3ade01224
4 changed files with 6 additions and 5 deletions

View File

@@ -554,7 +554,7 @@ class Rack(ChangeLoggedModel, CustomFieldModel):
# Validate outer dimensions and unit
if (self.outer_width is not None or self.outer_depth is not None) and self.outer_unit is None:
raise ValidationError("Must specify a unit when setting an outer width/depth")
else:
elif self.outer_width is None and self.outer_depth is None:
self.outer_unit = None
if self.pk:
@@ -2586,7 +2586,7 @@ class Cable(ChangeLoggedModel):
# Validate length and length_unit
if self.length is not None and self.length_unit is None:
raise ValidationError("Must specify a unit when setting a cable length")
else:
elif self.length is None:
self.length_unit = None
def save(self, *args, **kwargs):