From c72a14e6a60ecbbfe9e5841b509461627f574d0d Mon Sep 17 00:00:00 2001 From: Arthur Date: Thu, 20 Mar 2025 11:40:05 -0700 Subject: [PATCH] 16224 review changes --- netbox/dcim/forms/bulk_edit.py | 6 ++---- netbox/dcim/models/racks.py | 8 +++----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/netbox/dcim/forms/bulk_edit.py b/netbox/dcim/forms/bulk_edit.py index d8a9c695b..31f6fd9df 100644 --- a/netbox/dcim/forms/bulk_edit.py +++ b/netbox/dcim/forms/bulk_edit.py @@ -461,10 +461,8 @@ class RackBulkEditForm(NetBoxModelBulkEditForm): fieldsets = ( FieldSet('status', 'role', 'tenant', 'serial', 'asset_tag', 'rack_type', 'description', name=_('Rack')), FieldSet('region', 'site_group', 'site', 'location', name=_('Location')), - FieldSet( - 'form_factor', 'width', 'u_height', 'desc_units', 'airflow', 'outer_width', 'outer_height', 'outer_depth', - 'outer_unit', 'mounting_depth', name=_('Hardware') - ), + FieldSet('outer_width', 'outer_height', 'outer_depth', 'outer_unit', name=_('Outer Dimensions')), + FieldSet('form_factor', 'width', 'u_height', 'desc_units', 'airflow', 'mounting_depth', name=_('Hardware')), FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')), ) nullable_fields = ( diff --git a/netbox/dcim/models/racks.py b/netbox/dcim/models/racks.py index 5c4da3760..390d9ae9e 100644 --- a/netbox/dcim/models/racks.py +++ b/netbox/dcim/models/racks.py @@ -194,7 +194,7 @@ class RackType(RackBase): self._abs_max_weight = None # Clear unit if outer width & depth are not set - if self.outer_width is None and self.outer_depth is None and self.outer_height is None: + if not any([self.outer_width, self.outer_depth, self.outer_height]): self.outer_unit = None super().save(*args, **kwargs) @@ -371,9 +371,7 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, RackBase): raise ValidationError(_("Assigned location must belong to parent site ({site}).").format(site=self.site)) # Validate outer dimensions and unit - if ( - self.outer_width is not None or self.outer_depth is not None or self.outer_height is not None - ) and not self.outer_unit: + if any([self.outer_width, self.outer_depth, self.outer_height]) and not self.outer_unit: raise ValidationError(_("Must specify a unit when setting an outer dimension")) # Validate max_weight and weight_unit @@ -423,7 +421,7 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, RackBase): self._abs_max_weight = None # Clear unit if outer width & depth are not set - if self.outer_width is None and self.outer_depth is None and self.outer_height is None: + if not any([self.outer_width, self.outer_depth, self.outer_height]): self.outer_unit = None super().save(*args, **kwargs)