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 = (
|
fieldsets = (
|
||||||
FieldSet('status', 'role', 'tenant', 'serial', 'asset_tag', 'rack_type', 'description', name=_('Rack')),
|
FieldSet('status', 'role', 'tenant', 'serial', 'asset_tag', 'rack_type', 'description', name=_('Rack')),
|
||||||
FieldSet('region', 'site_group', 'site', 'location', name=_('Location')),
|
FieldSet('region', 'site_group', 'site', 'location', name=_('Location')),
|
||||||
FieldSet(
|
FieldSet('outer_width', 'outer_height', 'outer_depth', 'outer_unit', name=_('Outer Dimensions')),
|
||||||
'form_factor', 'width', 'u_height', 'desc_units', 'airflow', 'outer_width', 'outer_height', 'outer_depth',
|
FieldSet('form_factor', 'width', 'u_height', 'desc_units', 'airflow', 'mounting_depth', name=_('Hardware')),
|
||||||
'outer_unit', 'mounting_depth', name=_('Hardware')
|
|
||||||
),
|
|
||||||
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
|
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
|
||||||
)
|
)
|
||||||
nullable_fields = (
|
nullable_fields = (
|
||||||
|
@ -194,7 +194,7 @@ class RackType(RackBase):
|
|||||||
self._abs_max_weight = None
|
self._abs_max_weight = None
|
||||||
|
|
||||||
# Clear unit if outer width & depth are not set
|
# 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
|
self.outer_unit = None
|
||||||
|
|
||||||
super().save(*args, **kwargs)
|
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))
|
raise ValidationError(_("Assigned location must belong to parent site ({site}).").format(site=self.site))
|
||||||
|
|
||||||
# Validate outer dimensions and unit
|
# Validate outer dimensions and unit
|
||||||
if (
|
if any([self.outer_width, self.outer_depth, self.outer_height]) and not self.outer_unit:
|
||||||
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:
|
|
||||||
raise ValidationError(_("Must specify a unit when setting an outer dimension"))
|
raise ValidationError(_("Must specify a unit when setting an outer dimension"))
|
||||||
|
|
||||||
# Validate max_weight and weight_unit
|
# Validate max_weight and weight_unit
|
||||||
@ -423,7 +421,7 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, RackBase):
|
|||||||
self._abs_max_weight = None
|
self._abs_max_weight = None
|
||||||
|
|
||||||
# Clear unit if outer width & depth are not set
|
# 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
|
self.outer_unit = None
|
||||||
|
|
||||||
super().save(*args, **kwargs)
|
super().save(*args, **kwargs)
|
||||||
|
Loading…
Reference in New Issue
Block a user