mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-27 02:48:38 -06:00
16224 review changes
This commit is contained in:
parent
9df8e82492
commit
c72a14e6a6
@ -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 = (
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user