Rename 'type' to 'form_factor'

This commit is contained in:
Jeremy Stretch 2024-07-15 20:51:07 -04:00
parent 9d0bc01627
commit 32c5994462
15 changed files with 87 additions and 93 deletions

View File

@ -12,9 +12,9 @@ The [manufacturer](./manufacturer.md) which produces this type of rack.
The unique name of the rack type. The unique name of the rack type.
### Type ### Form Factor
A rack can be designated as one of the following types: A rack can be designated as one of the following form factors:
* 2-post frame * 2-post frame
* 4-post frame * 4-post frame

View File

@ -39,8 +39,8 @@ class RackTypeSerializer(NetBoxModelSerializer):
manufacturer = ManufacturerSerializer( manufacturer = ManufacturerSerializer(
nested=True nested=True
) )
type = ChoiceField( form_factor = ChoiceField(
choices=RackTypeChoices, choices=RackFormFactorChoices,
allow_blank=True, allow_blank=True,
required=False, required=False,
allow_null=True allow_null=True
@ -65,8 +65,8 @@ class RackTypeSerializer(NetBoxModelSerializer):
class Meta: class Meta:
model = RackType model = RackType
fields = [ fields = [
'id', 'url', 'display_url', 'display', 'manufacturer', 'name', 'slug', 'description', 'type', 'width', 'id', 'url', 'display_url', 'display', 'manufacturer', 'name', 'slug', 'description', 'form_factor',
'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'weight', 'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'weight',
'max_weight', 'weight_unit', 'mounting_depth', 'description', 'comments', 'tags', 'custom_fields', 'max_weight', 'weight_unit', 'mounting_depth', 'description', 'comments', 'tags', 'custom_fields',
'created', 'last_updated', 'created', 'last_updated',
] ]
@ -79,7 +79,7 @@ class RackSerializer(NetBoxModelSerializer):
tenant = TenantSerializer(nested=True, required=False, allow_null=True) tenant = TenantSerializer(nested=True, required=False, allow_null=True)
status = ChoiceField(choices=RackStatusChoices, required=False) status = ChoiceField(choices=RackStatusChoices, required=False)
role = RackRoleSerializer(nested=True, required=False, allow_null=True) role = RackRoleSerializer(nested=True, required=False, allow_null=True)
type = ChoiceField(choices=RackTypeChoices, allow_blank=True, required=False, allow_null=True) form_factor = ChoiceField(choices=RackFormFactorChoices, allow_blank=True, required=False, allow_null=True)
facility_id = serializers.CharField(max_length=50, allow_blank=True, allow_null=True, label=_('Facility ID'), facility_id = serializers.CharField(max_length=50, allow_blank=True, allow_null=True, label=_('Facility ID'),
default=None) default=None)
rack_type = RackTypeSerializer(nested=True, required=False, allow_null=True, default=None) rack_type = RackTypeSerializer(nested=True, required=False, allow_null=True, default=None)
@ -95,7 +95,7 @@ class RackSerializer(NetBoxModelSerializer):
model = Rack model = Rack
fields = [ fields = [
'id', 'url', 'display_url', 'display', 'name', 'facility_id', 'site', 'location', 'tenant', 'status', 'id', 'url', 'display_url', 'display', 'name', 'facility_id', 'site', 'location', 'tenant', 'status',
'role', 'serial', 'asset_tag', 'rack_type', 'type', 'width', 'u_height', 'starting_unit', 'weight', 'role', 'serial', 'asset_tag', 'rack_type', 'form_factor', 'width', 'u_height', 'starting_unit', 'weight',
'max_weight', 'weight_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'max_weight', 'weight_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth',
'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'device_count', 'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'device_count',
'powerfeed_count', 'powerfeed_count',

View File

@ -51,7 +51,7 @@ class LocationStatusChoices(ChoiceSet):
# Racks # Racks
# #
class RackTypeChoices(ChoiceSet): class RackFormFactorChoices(ChoiceSet):
TYPE_2POST = '2-post-frame' TYPE_2POST = '2-post-frame'
TYPE_4POST = '4-post-frame' TYPE_4POST = '4-post-frame'

View File

@ -301,8 +301,8 @@ class RackTypeFilterSet(NetBoxModelFilterSet):
to_field_name='slug', to_field_name='slug',
label=_('Manufacturer (slug)'), label=_('Manufacturer (slug)'),
) )
type = django_filters.MultipleChoiceFilter( form_factor = django_filters.MultipleChoiceFilter(
choices=RackTypeChoices choices=RackFormFactorChoices
) )
width = django_filters.MultipleChoiceFilter( width = django_filters.MultipleChoiceFilter(
choices=RackWidthChoices choices=RackWidthChoices
@ -389,8 +389,8 @@ class RackFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSe
choices=RackStatusChoices, choices=RackStatusChoices,
null_value=None null_value=None
) )
type = django_filters.MultipleChoiceFilter( form_factor = django_filters.MultipleChoiceFilter(
choices=RackTypeChoices choices=RackFormFactorChoices
) )
width = django_filters.MultipleChoiceFilter( width = django_filters.MultipleChoiceFilter(
choices=RackWidthChoices choices=RackWidthChoices

View File

@ -225,9 +225,9 @@ class RackTypeBulkEditForm(NetBoxModelBulkEditForm):
queryset=Manufacturer.objects.all(), queryset=Manufacturer.objects.all(),
required=False required=False
) )
type = forms.ChoiceField( form_factor = forms.ChoiceField(
label=_('Type'), label=_('Form factor'),
choices=add_blank_choice(RackTypeChoices), choices=add_blank_choice(RackFormFactorChoices),
required=False required=False
) )
width = forms.ChoiceField( width = forms.ChoiceField(
@ -293,7 +293,7 @@ class RackTypeBulkEditForm(NetBoxModelBulkEditForm):
model = RackType model = RackType
fieldsets = ( fieldsets = (
FieldSet('manufacturer', 'description', 'type', name=_('Rack Type')), FieldSet('manufacturer', 'description', 'form_factor', name=_('Rack Type')),
FieldSet( FieldSet(
'width', 'width',
'u_height', 'u_height',
@ -370,9 +370,9 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
max_length=50, max_length=50,
required=False required=False
) )
type = forms.ChoiceField( form_factor = forms.ChoiceField(
label=_('Type'), label=_('Form factor'),
choices=add_blank_choice(RackTypeChoices), choices=add_blank_choice(RackFormFactorChoices),
required=False required=False
) )
width = forms.ChoiceField( width = forms.ChoiceField(
@ -437,8 +437,8 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
FieldSet('status', 'role', 'tenant', 'serial', 'asset_tag', 'description', name=_('Rack')), FieldSet('status', 'role', 'tenant', 'serial', 'asset_tag', 'description', name=_('Rack')),
FieldSet('region', 'site_group', 'site', 'location', name=_('Location')), FieldSet('region', 'site_group', 'site', 'location', name=_('Location')),
FieldSet( FieldSet(
'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'form_factor', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit',
name=_('Hardware') 'mounting_depth', name=_('Hardware')
), ),
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')), FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
) )

View File

@ -184,11 +184,11 @@ class RackTypeImportForm(NetBoxModelImportForm):
to_field_name='name', to_field_name='name',
help_text=_('The manufacturer of this rack type') help_text=_('The manufacturer of this rack type')
) )
type = CSVChoiceField( form_factor = CSVChoiceField(
label=_('Type'), label=_('Type'),
choices=RackTypeChoices, choices=RackFormFactorChoices,
required=False, required=False,
help_text=_('Rack type') help_text=_('Form factor')
) )
starting_unit = forms.IntegerField( starting_unit = forms.IntegerField(
required=False, required=False,
@ -216,9 +216,9 @@ class RackTypeImportForm(NetBoxModelImportForm):
class Meta: class Meta:
model = RackType model = RackType
fields = ( fields = (
'manufacturer', 'name', 'slug', 'type', 'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'manufacturer', 'name', 'slug', 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units',
'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit',
'comments', 'tags', 'description', 'comments', 'tags',
) )
def __init__(self, data=None, *args, **kwargs): def __init__(self, data=None, *args, **kwargs):
@ -256,11 +256,11 @@ class RackImportForm(NetBoxModelImportForm):
to_field_name='name', to_field_name='name',
help_text=_('Name of assigned role') help_text=_('Name of assigned role')
) )
type = CSVChoiceField( form_factor = CSVChoiceField(
label=_('Type'), label=_('Type'),
choices=RackTypeChoices, choices=RackFormFactorChoices,
required=False, required=False,
help_text=_('Rack type') help_text=_('Form factor')
) )
width = forms.ChoiceField( width = forms.ChoiceField(
label=_('Width'), label=_('Width'),
@ -283,7 +283,7 @@ class RackImportForm(NetBoxModelImportForm):
class Meta: class Meta:
model = Rack model = Rack
fields = ( fields = (
'site', 'location', 'name', 'facility_id', 'tenant', 'status', 'role', 'type', 'serial', 'asset_tag', 'site', 'location', 'name', 'facility_id', 'tenant', 'status', 'role', 'form_factor', 'serial', 'asset_tag',
'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight',
'max_weight', 'weight_unit', 'description', 'comments', 'tags', 'max_weight', 'weight_unit', 'description', 'comments', 'tags',
) )

View File

@ -245,7 +245,7 @@ class RackTypeFilterForm(NetBoxModelFilterSetForm):
model = RackType model = RackType
fieldsets = ( fieldsets = (
FieldSet('q', 'filter_id', 'tag'), FieldSet('q', 'filter_id', 'tag'),
FieldSet('type', 'width', 'u_height', 'starting_unit', name=_('Rack Type')), FieldSet('form_factor', 'width', 'u_height', 'starting_unit', name=_('Rack Type')),
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')), FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
) )
selector_fields = ('filter_id', 'q', 'manufacturer_id') selector_fields = ('filter_id', 'q', 'manufacturer_id')
@ -254,9 +254,9 @@ class RackTypeFilterForm(NetBoxModelFilterSetForm):
required=False, required=False,
label=_('Manufacturer') label=_('Manufacturer')
) )
type = forms.MultipleChoiceField( form_factor = forms.MultipleChoiceField(
label=_('Type'), label=_('Form factor'),
choices=RackTypeChoices, choices=RackFormFactorChoices,
required=False required=False
) )
width = forms.MultipleChoiceField( width = forms.MultipleChoiceField(
@ -303,7 +303,7 @@ class RackFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilte
FieldSet('q', 'filter_id', 'tag'), FieldSet('q', 'filter_id', 'tag'),
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', name=_('Location')), FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', name=_('Location')),
FieldSet('status', 'role_id', name=_('Function')), FieldSet('status', 'role_id', name=_('Function')),
FieldSet('type', 'width', 'serial', 'asset_tag', name=_('Hardware')), FieldSet('form_factor', 'width', 'serial', 'asset_tag', name=_('Hardware')),
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')), FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')), FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')),
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')), FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
@ -341,9 +341,9 @@ class RackFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilte
choices=RackStatusChoices, choices=RackStatusChoices,
required=False required=False
) )
type = forms.MultipleChoiceField( form_factor = forms.MultipleChoiceField(
label=_('Type'), label=_('Form factor'),
choices=RackTypeChoices, choices=RackFormFactorChoices,
required=False required=False
) )
width = forms.MultipleChoiceField( width = forms.MultipleChoiceField(

View File

@ -211,7 +211,7 @@ class RackTypeForm(NetBoxModelForm):
slug = SlugField() slug = SlugField()
fieldsets = ( fieldsets = (
FieldSet('manufacturer', 'name', 'slug', 'description', 'type', 'tags', name=_('Rack Type')), FieldSet('manufacturer', 'name', 'slug', 'description', 'form_factor', 'tags', name=_('Rack Type')),
FieldSet( FieldSet(
'width', 'u_height', 'width', 'u_height',
InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')), InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')),
@ -224,9 +224,9 @@ class RackTypeForm(NetBoxModelForm):
class Meta: class Meta:
model = RackType model = RackType
fields = [ fields = [
'manufacturer', 'name', 'slug', 'type', 'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'manufacturer', 'name', 'slug', 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units',
'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit',
'comments', 'tags', 'description', 'comments', 'tags',
] ]
@ -261,7 +261,7 @@ class RackForm(TenancyForm, NetBoxModelForm):
FieldSet('facility_id', 'serial', 'asset_tag', name=_('Inventory Control')), FieldSet('facility_id', 'serial', 'asset_tag', name=_('Inventory Control')),
FieldSet('tenant_group', 'tenant', name=_('Tenancy')), FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
FieldSet( FieldSet(
'rack_type', 'type', 'width', 'starting_unit', 'u_height', 'rack_type', 'form_factor', 'width', 'starting_unit', 'u_height',
InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')), InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')),
InlineFields('weight', 'max_weight', 'weight_unit', label=_('Weight')), InlineFields('weight', 'max_weight', 'weight_unit', label=_('Weight')),
'mounting_depth', 'desc_units', name=_('Dimensions') 'mounting_depth', 'desc_units', name=_('Dimensions')
@ -272,8 +272,9 @@ class RackForm(TenancyForm, NetBoxModelForm):
model = Rack model = Rack
fields = [ fields = [
'site', 'location', 'name', 'facility_id', 'tenant_group', 'tenant', 'status', 'role', 'serial', 'site', 'location', 'name', 'facility_id', 'tenant_group', 'tenant', 'status', 'role', 'serial',
'asset_tag', 'rack_type', 'type', 'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', 'asset_tag', 'rack_type', 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width',
'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description', 'comments', 'tags', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description',
'comments', 'tags',
] ]
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

View File

@ -46,7 +46,7 @@ class Migration(migrations.Migration):
), ),
), ),
('slug', models.SlugField(max_length=100, unique=True)), ('slug', models.SlugField(max_length=100, unique=True)),
('type', models.CharField(blank=True, max_length=50)), ('form_factor', models.CharField(blank=True, max_length=50)),
('width', models.PositiveSmallIntegerField(default=19)), ('width', models.PositiveSmallIntegerField(default=19)),
('u_height', models.PositiveSmallIntegerField( ('u_height', models.PositiveSmallIntegerField(
default=42, default=42,
@ -74,6 +74,11 @@ class Migration(migrations.Migration):
'ordering': ('_name', 'pk'), 'ordering': ('_name', 'pk'),
}, },
), ),
migrations.RenameField(
model_name='rack',
old_name='type',
new_name='form_factor',
),
migrations.AddField( migrations.AddField(
model_name='rack', model_name='rack',
name='rack_type', name='rack_type',

View File

@ -67,11 +67,11 @@ class RackType(WeightMixin, PrimaryModel):
max_length=100, max_length=100,
unique=True unique=True
) )
type = models.CharField( form_factor = models.CharField(
choices=RackTypeChoices, choices=RackFormFactorChoices,
max_length=50, max_length=50,
blank=True, blank=True,
verbose_name=_('type') verbose_name=_('form factor')
) )
width = models.PositiveSmallIntegerField( width = models.PositiveSmallIntegerField(
choices=RackWidthChoices, choices=RackWidthChoices,
@ -136,7 +136,7 @@ class RackType(WeightMixin, PrimaryModel):
) )
clone_fields = ( clone_fields = (
'manufacturer', 'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'manufacturer', 'form_factor', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit',
'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit',
) )
prerequisite_models = ( prerequisite_models = (
@ -181,8 +181,8 @@ class RackType(WeightMixin, PrimaryModel):
super().save(*args, **kwargs) super().save(*args, **kwargs)
if update: if update:
# Update all racks associated with this rack_type # Update all racks associated with this rack_type
self.instances.all().update( self.instances.update(
type=self.type, form_factor=self.form_factor,
width=self.width, width=self.width,
u_height=self.u_height, u_height=self.u_height,
starting_unit=self.starting_unit, starting_unit=self.starting_unit,
@ -302,11 +302,11 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, PrimaryModel, WeightMixin):
verbose_name=_('asset tag'), verbose_name=_('asset tag'),
help_text=_('A unique tag used to identify this rack') help_text=_('A unique tag used to identify this rack')
) )
type = models.CharField( form_factor = models.CharField(
choices=RackTypeChoices, choices=RackFormFactorChoices,
max_length=50, max_length=50,
blank=True, blank=True,
verbose_name=_('type') verbose_name=_('form factor')
) )
width = models.PositiveSmallIntegerField( width = models.PositiveSmallIntegerField(
choices=RackWidthChoices, choices=RackWidthChoices,
@ -379,7 +379,7 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, PrimaryModel, WeightMixin):
) )
clone_fields = ( clone_fields = (
'site', 'location', 'tenant', 'status', 'role', 'type', 'width', 'u_height', 'desc_units', 'outer_width', 'site', 'location', 'tenant', 'status', 'role', 'form_factor', 'width', 'u_height', 'desc_units', 'outer_width',
'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit',
) )
prerequisite_models = ( prerequisite_models = (
@ -460,7 +460,7 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, PrimaryModel, WeightMixin):
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
if (not self.pk) and self.rack_type: if (not self.pk) and self.rack_type:
self.type = self.rack_type.type self.form_factor = self.rack_type.form_factor
self.width = self.rack_type.width self.width = self.rack_type.width
self.u_height = self.rack_type.u_height self.u_height = self.rack_type.u_height
self.starting_unit = self.rack_type.starting_unit self.starting_unit = self.rack_type.starting_unit

View File

@ -91,7 +91,7 @@ class RackTypeTable(NetBoxTable):
class Meta(NetBoxTable.Meta): class Meta(NetBoxTable.Meta):
model = RackType model = RackType
fields = ( fields = (
'pk', 'id', 'name', 'manufacturer', 'type', 'u_height', 'starting_unit', 'width', 'outer_width', 'pk', 'id', 'name', 'manufacturer', 'form_factor', 'u_height', 'starting_unit', 'width', 'outer_width',
'outer_depth', 'mounting_depth', 'weight', 'max_weight', 'description', 'comments', 'tags', 'created', 'outer_depth', 'mounting_depth', 'weight', 'max_weight', 'description', 'comments', 'tags', 'created',
'last_updated', 'last_updated',
) )
@ -170,9 +170,9 @@ class RackTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
model = Rack model = Rack
fields = ( fields = (
'pk', 'id', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'tenant_group', 'role', 'serial', 'pk', 'id', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'tenant_group', 'role', 'serial',
'asset_tag', 'type', 'u_height', 'starting_unit', 'width', 'outer_width', 'outer_depth', 'mounting_depth', 'asset_tag', 'form_factor', 'u_height', 'starting_unit', 'width', 'outer_width', 'outer_depth',
'weight', 'max_weight', 'comments', 'device_count', 'get_utilization', 'get_power_utilization', 'mounting_depth', 'weight', 'max_weight', 'comments', 'device_count', 'get_utilization',
'description', 'contacts', 'tags', 'created', 'last_updated', 'get_power_utilization', 'description', 'contacts', 'tags', 'created', 'last_updated',
) )
default_columns = ( default_columns = (
'pk', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'u_height', 'device_count', 'pk', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'u_height', 'device_count',

View File

@ -486,7 +486,7 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
manufacturer=manufacturers[0], manufacturer=manufacturers[0],
name='RackType 1', name='RackType 1',
slug='rack-type-1', slug='rack-type-1',
type=RackTypeChoices.TYPE_2POST, form_factor=RackFormFactorChoices.TYPE_2POST,
width=RackWidthChoices.WIDTH_19IN, width=RackWidthChoices.WIDTH_19IN,
u_height=42, u_height=42,
starting_unit=1, starting_unit=1,
@ -504,7 +504,7 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
manufacturer=manufacturers[1], manufacturer=manufacturers[1],
name='RackType 2', name='RackType 2',
slug='rack-type-2', slug='rack-type-2',
type=RackTypeChoices.TYPE_4POST, form_factor=RackFormFactorChoices.TYPE_4POST,
width=RackWidthChoices.WIDTH_21IN, width=RackWidthChoices.WIDTH_21IN,
u_height=43, u_height=43,
starting_unit=2, starting_unit=2,
@ -522,7 +522,7 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
manufacturer=manufacturers[2], manufacturer=manufacturers[2],
name='RackType 3', name='RackType 3',
slug='rack-type-3', slug='rack-type-3',
type=RackTypeChoices.TYPE_CABINET, form_factor=RackFormFactorChoices.TYPE_CABINET,
width=RackWidthChoices.WIDTH_23IN, width=RackWidthChoices.WIDTH_23IN,
u_height=44, u_height=44,
starting_unit=3, starting_unit=3,
@ -562,8 +562,8 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
params = {'description': ['foobar1', 'foobar2']} params = {'description': ['foobar1', 'foobar2']}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
def test_type(self): def test_form_factor(self):
params = {'type': [RackTypeChoices.TYPE_2POST, RackTypeChoices.TYPE_4POST]} params = {'form_factor': [RackFormFactorChoices.TYPE_2POST, RackFormFactorChoices.TYPE_4POST]}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
def test_width(self): def test_width(self):
@ -686,7 +686,7 @@ class RackTestCase(TestCase, ChangeLoggedFilterSetTests):
role=rack_roles[0], role=rack_roles[0],
serial='ABC', serial='ABC',
asset_tag='1001', asset_tag='1001',
type=RackTypeChoices.TYPE_2POST, form_factor=RackFormFactorChoices.TYPE_2POST,
width=RackWidthChoices.WIDTH_19IN, width=RackWidthChoices.WIDTH_19IN,
u_height=42, u_height=42,
desc_units=False, desc_units=False,
@ -708,7 +708,7 @@ class RackTestCase(TestCase, ChangeLoggedFilterSetTests):
role=rack_roles[1], role=rack_roles[1],
serial='DEF', serial='DEF',
asset_tag='1002', asset_tag='1002',
type=RackTypeChoices.TYPE_4POST, form_factor=RackFormFactorChoices.TYPE_4POST,
width=RackWidthChoices.WIDTH_21IN, width=RackWidthChoices.WIDTH_21IN,
u_height=43, u_height=43,
desc_units=False, desc_units=False,
@ -730,7 +730,7 @@ class RackTestCase(TestCase, ChangeLoggedFilterSetTests):
role=rack_roles[2], role=rack_roles[2],
serial='GHI', serial='GHI',
asset_tag='1003', asset_tag='1003',
type=RackTypeChoices.TYPE_CABINET, form_factor=RackFormFactorChoices.TYPE_CABINET,
width=RackWidthChoices.WIDTH_23IN, width=RackWidthChoices.WIDTH_23IN,
u_height=44, u_height=44,
desc_units=True, desc_units=True,
@ -765,8 +765,8 @@ class RackTestCase(TestCase, ChangeLoggedFilterSetTests):
params = {'description': ['foobar1', 'foobar2']} params = {'description': ['foobar1', 'foobar2']}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
def test_type(self): def test_form_factor(self):
params = {'type': [RackTypeChoices.TYPE_2POST, RackTypeChoices.TYPE_4POST]} params = {'form_factor': [RackFormFactorChoices.TYPE_2POST, RackFormFactorChoices.TYPE_4POST]}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2) self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
def test_width(self): def test_width(self):

View File

@ -360,7 +360,7 @@ class RackTypeTestCase(ViewTestCases.PrimaryObjectViewTestCase):
'manufacturer': manufacturers[1].pk, 'manufacturer': manufacturers[1].pk,
'name': 'RackType X', 'name': 'RackType X',
'slug': 'rack-type-x', 'slug': 'rack-type-x',
'type': RackTypeChoices.TYPE_CABINET, 'type': RackFormFactorChoices.TYPE_CABINET,
'width': RackWidthChoices.WIDTH_19IN, 'width': RackWidthChoices.WIDTH_19IN,
'u_height': 48, 'u_height': 48,
'desc_units': False, 'desc_units': False,
@ -391,7 +391,7 @@ class RackTypeTestCase(ViewTestCases.PrimaryObjectViewTestCase):
cls.bulk_edit_data = { cls.bulk_edit_data = {
'manufacturer': manufacturers[1].pk, 'manufacturer': manufacturers[1].pk,
'type': RackTypeChoices.TYPE_4POST, 'type': RackFormFactorChoices.TYPE_4POST,
'width': RackWidthChoices.WIDTH_23IN, 'width': RackWidthChoices.WIDTH_23IN,
'u_height': 49, 'u_height': 49,
'desc_units': True, 'desc_units': True,
@ -449,7 +449,7 @@ class RackTestCase(ViewTestCases.PrimaryObjectViewTestCase):
'role': rackroles[1].pk, 'role': rackroles[1].pk,
'serial': '123456', 'serial': '123456',
'asset_tag': 'ABCDEF', 'asset_tag': 'ABCDEF',
'type': RackTypeChoices.TYPE_CABINET, 'form_factor': RackFormFactorChoices.TYPE_CABINET,
'width': RackWidthChoices.WIDTH_19IN, 'width': RackWidthChoices.WIDTH_19IN,
'u_height': 48, 'u_height': 48,
'desc_units': False, 'desc_units': False,
@ -485,7 +485,7 @@ class RackTestCase(ViewTestCases.PrimaryObjectViewTestCase):
'status': RackStatusChoices.STATUS_DEPRECATED, 'status': RackStatusChoices.STATUS_DEPRECATED,
'role': rackroles[1].pk, 'role': rackroles[1].pk,
'serial': '654321', 'serial': '654321',
'type': RackTypeChoices.TYPE_4POST, 'form_factor': RackFormFactorChoices.TYPE_4POST,
'width': RackWidthChoices.WIDTH_23IN, 'width': RackWidthChoices.WIDTH_23IN,
'u_height': 49, 'u_height': 49,
'desc_units': True, 'desc_units': True,

View File

@ -73,14 +73,8 @@
<h5 class="card-header">{% trans "Dimensions" %}</h5> <h5 class="card-header">{% trans "Dimensions" %}</h5>
<table class="table table-hover attr-table"> <table class="table table-hover attr-table">
<tr> <tr>
<th scope="row">{% trans "Type" %}</th> <th scope="row">{% trans "Form factor" %}</th>
<td> <td>{{ object.get_form_factor_display|placeholder }}</td>
{% if object.type %}
{{ object.get_type_display }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr> </tr>
<tr> <tr>
<th scope="row">{% trans "Width" %}</th> <th scope="row">{% trans "Width" %}</th>

View File

@ -21,14 +21,8 @@
<td>{{ object.name }}</td> <td>{{ object.name }}</td>
</tr> </tr>
<tr> <tr>
<th scope="row">{% trans "Type" %}</th> <th scope="row">{% trans "Form factor" %}</th>
<td> <td>{{ object.get_form_factor_display|placeholder }}</td>
{% if object.type %}
{{ object.get_type_display }}
{% else %}
{{ ''|placeholder }}
{% endif %}
</td>
</tr> </tr>
<tr> <tr>
<th scope="row">{% trans "Description" %}</th> <th scope="row">{% trans "Description" %}</th>