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:
@@ -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):
|
||||
|
Reference in New Issue
Block a user