mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-08 08:38:16 -06:00
Rename 'type' to 'form_factor'
This commit is contained in:
parent
9d0bc01627
commit
32c5994462
@ -12,9 +12,9 @@ The [manufacturer](./manufacturer.md) which produces this type of rack.
|
||||
|
||||
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
|
||||
* 4-post frame
|
||||
|
@ -39,8 +39,8 @@ class RackTypeSerializer(NetBoxModelSerializer):
|
||||
manufacturer = ManufacturerSerializer(
|
||||
nested=True
|
||||
)
|
||||
type = ChoiceField(
|
||||
choices=RackTypeChoices,
|
||||
form_factor = ChoiceField(
|
||||
choices=RackFormFactorChoices,
|
||||
allow_blank=True,
|
||||
required=False,
|
||||
allow_null=True
|
||||
@ -65,8 +65,8 @@ class RackTypeSerializer(NetBoxModelSerializer):
|
||||
class Meta:
|
||||
model = RackType
|
||||
fields = [
|
||||
'id', 'url', 'display_url', 'display', 'manufacturer', 'name', 'slug', 'description', 'type', 'width',
|
||||
'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'weight',
|
||||
'id', 'url', 'display_url', 'display', 'manufacturer', 'name', 'slug', 'description', 'form_factor',
|
||||
'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',
|
||||
'created', 'last_updated',
|
||||
]
|
||||
@ -79,7 +79,7 @@ class RackSerializer(NetBoxModelSerializer):
|
||||
tenant = TenantSerializer(nested=True, required=False, allow_null=True)
|
||||
status = ChoiceField(choices=RackStatusChoices, required=False)
|
||||
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'),
|
||||
default=None)
|
||||
rack_type = RackTypeSerializer(nested=True, required=False, allow_null=True, default=None)
|
||||
@ -95,7 +95,7 @@ class RackSerializer(NetBoxModelSerializer):
|
||||
model = Rack
|
||||
fields = [
|
||||
'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',
|
||||
'description', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'device_count',
|
||||
'powerfeed_count',
|
||||
|
@ -51,7 +51,7 @@ class LocationStatusChoices(ChoiceSet):
|
||||
# Racks
|
||||
#
|
||||
|
||||
class RackTypeChoices(ChoiceSet):
|
||||
class RackFormFactorChoices(ChoiceSet):
|
||||
|
||||
TYPE_2POST = '2-post-frame'
|
||||
TYPE_4POST = '4-post-frame'
|
||||
|
@ -301,8 +301,8 @@ class RackTypeFilterSet(NetBoxModelFilterSet):
|
||||
to_field_name='slug',
|
||||
label=_('Manufacturer (slug)'),
|
||||
)
|
||||
type = django_filters.MultipleChoiceFilter(
|
||||
choices=RackTypeChoices
|
||||
form_factor = django_filters.MultipleChoiceFilter(
|
||||
choices=RackFormFactorChoices
|
||||
)
|
||||
width = django_filters.MultipleChoiceFilter(
|
||||
choices=RackWidthChoices
|
||||
@ -389,8 +389,8 @@ class RackFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSe
|
||||
choices=RackStatusChoices,
|
||||
null_value=None
|
||||
)
|
||||
type = django_filters.MultipleChoiceFilter(
|
||||
choices=RackTypeChoices
|
||||
form_factor = django_filters.MultipleChoiceFilter(
|
||||
choices=RackFormFactorChoices
|
||||
)
|
||||
width = django_filters.MultipleChoiceFilter(
|
||||
choices=RackWidthChoices
|
||||
|
@ -225,9 +225,9 @@ class RackTypeBulkEditForm(NetBoxModelBulkEditForm):
|
||||
queryset=Manufacturer.objects.all(),
|
||||
required=False
|
||||
)
|
||||
type = forms.ChoiceField(
|
||||
label=_('Type'),
|
||||
choices=add_blank_choice(RackTypeChoices),
|
||||
form_factor = forms.ChoiceField(
|
||||
label=_('Form factor'),
|
||||
choices=add_blank_choice(RackFormFactorChoices),
|
||||
required=False
|
||||
)
|
||||
width = forms.ChoiceField(
|
||||
@ -293,7 +293,7 @@ class RackTypeBulkEditForm(NetBoxModelBulkEditForm):
|
||||
|
||||
model = RackType
|
||||
fieldsets = (
|
||||
FieldSet('manufacturer', 'description', 'type', name=_('Rack Type')),
|
||||
FieldSet('manufacturer', 'description', 'form_factor', name=_('Rack Type')),
|
||||
FieldSet(
|
||||
'width',
|
||||
'u_height',
|
||||
@ -370,9 +370,9 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
|
||||
max_length=50,
|
||||
required=False
|
||||
)
|
||||
type = forms.ChoiceField(
|
||||
label=_('Type'),
|
||||
choices=add_blank_choice(RackTypeChoices),
|
||||
form_factor = forms.ChoiceField(
|
||||
label=_('Form factor'),
|
||||
choices=add_blank_choice(RackFormFactorChoices),
|
||||
required=False
|
||||
)
|
||||
width = forms.ChoiceField(
|
||||
@ -437,8 +437,8 @@ class RackBulkEditForm(NetBoxModelBulkEditForm):
|
||||
FieldSet('status', 'role', 'tenant', 'serial', 'asset_tag', 'description', name=_('Rack')),
|
||||
FieldSet('region', 'site_group', 'site', 'location', name=_('Location')),
|
||||
FieldSet(
|
||||
'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth',
|
||||
name=_('Hardware')
|
||||
'form_factor', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit',
|
||||
'mounting_depth', name=_('Hardware')
|
||||
),
|
||||
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
|
||||
)
|
||||
|
@ -184,11 +184,11 @@ class RackTypeImportForm(NetBoxModelImportForm):
|
||||
to_field_name='name',
|
||||
help_text=_('The manufacturer of this rack type')
|
||||
)
|
||||
type = CSVChoiceField(
|
||||
form_factor = CSVChoiceField(
|
||||
label=_('Type'),
|
||||
choices=RackTypeChoices,
|
||||
choices=RackFormFactorChoices,
|
||||
required=False,
|
||||
help_text=_('Rack type')
|
||||
help_text=_('Form factor')
|
||||
)
|
||||
starting_unit = forms.IntegerField(
|
||||
required=False,
|
||||
@ -216,9 +216,9 @@ class RackTypeImportForm(NetBoxModelImportForm):
|
||||
class Meta:
|
||||
model = RackType
|
||||
fields = (
|
||||
'manufacturer', 'name', 'slug', 'type', 'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width',
|
||||
'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description',
|
||||
'comments', 'tags',
|
||||
'manufacturer', 'name', 'slug', 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units',
|
||||
'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit',
|
||||
'description', 'comments', 'tags',
|
||||
)
|
||||
|
||||
def __init__(self, data=None, *args, **kwargs):
|
||||
@ -256,11 +256,11 @@ class RackImportForm(NetBoxModelImportForm):
|
||||
to_field_name='name',
|
||||
help_text=_('Name of assigned role')
|
||||
)
|
||||
type = CSVChoiceField(
|
||||
form_factor = CSVChoiceField(
|
||||
label=_('Type'),
|
||||
choices=RackTypeChoices,
|
||||
choices=RackFormFactorChoices,
|
||||
required=False,
|
||||
help_text=_('Rack type')
|
||||
help_text=_('Form factor')
|
||||
)
|
||||
width = forms.ChoiceField(
|
||||
label=_('Width'),
|
||||
@ -283,7 +283,7 @@ class RackImportForm(NetBoxModelImportForm):
|
||||
class Meta:
|
||||
model = Rack
|
||||
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',
|
||||
'max_weight', 'weight_unit', 'description', 'comments', 'tags',
|
||||
)
|
||||
|
@ -245,7 +245,7 @@ class RackTypeFilterForm(NetBoxModelFilterSetForm):
|
||||
model = RackType
|
||||
fieldsets = (
|
||||
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')),
|
||||
)
|
||||
selector_fields = ('filter_id', 'q', 'manufacturer_id')
|
||||
@ -254,9 +254,9 @@ class RackTypeFilterForm(NetBoxModelFilterSetForm):
|
||||
required=False,
|
||||
label=_('Manufacturer')
|
||||
)
|
||||
type = forms.MultipleChoiceField(
|
||||
label=_('Type'),
|
||||
choices=RackTypeChoices,
|
||||
form_factor = forms.MultipleChoiceField(
|
||||
label=_('Form factor'),
|
||||
choices=RackFormFactorChoices,
|
||||
required=False
|
||||
)
|
||||
width = forms.MultipleChoiceField(
|
||||
@ -303,7 +303,7 @@ class RackFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilte
|
||||
FieldSet('q', 'filter_id', 'tag'),
|
||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', name=_('Location')),
|
||||
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('contact', 'contact_role', 'contact_group', name=_('Contacts')),
|
||||
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
|
||||
@ -341,9 +341,9 @@ class RackFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFilte
|
||||
choices=RackStatusChoices,
|
||||
required=False
|
||||
)
|
||||
type = forms.MultipleChoiceField(
|
||||
label=_('Type'),
|
||||
choices=RackTypeChoices,
|
||||
form_factor = forms.MultipleChoiceField(
|
||||
label=_('Form factor'),
|
||||
choices=RackFormFactorChoices,
|
||||
required=False
|
||||
)
|
||||
width = forms.MultipleChoiceField(
|
||||
|
@ -211,7 +211,7 @@ class RackTypeForm(NetBoxModelForm):
|
||||
slug = SlugField()
|
||||
|
||||
fieldsets = (
|
||||
FieldSet('manufacturer', 'name', 'slug', 'description', 'type', 'tags', name=_('Rack Type')),
|
||||
FieldSet('manufacturer', 'name', 'slug', 'description', 'form_factor', 'tags', name=_('Rack Type')),
|
||||
FieldSet(
|
||||
'width', 'u_height',
|
||||
InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')),
|
||||
@ -224,9 +224,9 @@ class RackTypeForm(NetBoxModelForm):
|
||||
class Meta:
|
||||
model = RackType
|
||||
fields = [
|
||||
'manufacturer', 'name', 'slug', 'type', 'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width',
|
||||
'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description',
|
||||
'comments', 'tags',
|
||||
'manufacturer', 'name', 'slug', 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units',
|
||||
'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit',
|
||||
'description', 'comments', 'tags',
|
||||
]
|
||||
|
||||
|
||||
@ -261,7 +261,7 @@ class RackForm(TenancyForm, NetBoxModelForm):
|
||||
FieldSet('facility_id', 'serial', 'asset_tag', name=_('Inventory Control')),
|
||||
FieldSet('tenant_group', 'tenant', name=_('Tenancy')),
|
||||
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('weight', 'max_weight', 'weight_unit', label=_('Weight')),
|
||||
'mounting_depth', 'desc_units', name=_('Dimensions')
|
||||
@ -272,8 +272,9 @@ class RackForm(TenancyForm, NetBoxModelForm):
|
||||
model = Rack
|
||||
fields = [
|
||||
'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',
|
||||
'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description', 'comments', 'tags',
|
||||
'asset_tag', 'rack_type', 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width',
|
||||
'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description',
|
||||
'comments', 'tags',
|
||||
]
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
@ -46,7 +46,7 @@ class Migration(migrations.Migration):
|
||||
),
|
||||
),
|
||||
('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)),
|
||||
('u_height', models.PositiveSmallIntegerField(
|
||||
default=42,
|
||||
@ -74,6 +74,11 @@ class Migration(migrations.Migration):
|
||||
'ordering': ('_name', 'pk'),
|
||||
},
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='rack',
|
||||
old_name='type',
|
||||
new_name='form_factor',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='rack',
|
||||
name='rack_type',
|
||||
|
@ -67,11 +67,11 @@ class RackType(WeightMixin, PrimaryModel):
|
||||
max_length=100,
|
||||
unique=True
|
||||
)
|
||||
type = models.CharField(
|
||||
choices=RackTypeChoices,
|
||||
form_factor = models.CharField(
|
||||
choices=RackFormFactorChoices,
|
||||
max_length=50,
|
||||
blank=True,
|
||||
verbose_name=_('type')
|
||||
verbose_name=_('form factor')
|
||||
)
|
||||
width = models.PositiveSmallIntegerField(
|
||||
choices=RackWidthChoices,
|
||||
@ -136,7 +136,7 @@ class RackType(WeightMixin, PrimaryModel):
|
||||
)
|
||||
|
||||
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',
|
||||
)
|
||||
prerequisite_models = (
|
||||
@ -181,8 +181,8 @@ class RackType(WeightMixin, PrimaryModel):
|
||||
super().save(*args, **kwargs)
|
||||
if update:
|
||||
# Update all racks associated with this rack_type
|
||||
self.instances.all().update(
|
||||
type=self.type,
|
||||
self.instances.update(
|
||||
form_factor=self.form_factor,
|
||||
width=self.width,
|
||||
u_height=self.u_height,
|
||||
starting_unit=self.starting_unit,
|
||||
@ -302,11 +302,11 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, PrimaryModel, WeightMixin):
|
||||
verbose_name=_('asset tag'),
|
||||
help_text=_('A unique tag used to identify this rack')
|
||||
)
|
||||
type = models.CharField(
|
||||
choices=RackTypeChoices,
|
||||
form_factor = models.CharField(
|
||||
choices=RackFormFactorChoices,
|
||||
max_length=50,
|
||||
blank=True,
|
||||
verbose_name=_('type')
|
||||
verbose_name=_('form factor')
|
||||
)
|
||||
width = models.PositiveSmallIntegerField(
|
||||
choices=RackWidthChoices,
|
||||
@ -379,7 +379,7 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, PrimaryModel, WeightMixin):
|
||||
)
|
||||
|
||||
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',
|
||||
)
|
||||
prerequisite_models = (
|
||||
@ -460,7 +460,7 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, PrimaryModel, WeightMixin):
|
||||
|
||||
def save(self, *args, **kwargs):
|
||||
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.u_height = self.rack_type.u_height
|
||||
self.starting_unit = self.rack_type.starting_unit
|
||||
|
@ -91,7 +91,7 @@ class RackTypeTable(NetBoxTable):
|
||||
class Meta(NetBoxTable.Meta):
|
||||
model = RackType
|
||||
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',
|
||||
'last_updated',
|
||||
)
|
||||
@ -170,9 +170,9 @@ class RackTable(TenancyColumnsMixin, ContactsColumnMixin, NetBoxTable):
|
||||
model = Rack
|
||||
fields = (
|
||||
'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',
|
||||
'weight', 'max_weight', 'comments', 'device_count', 'get_utilization', 'get_power_utilization',
|
||||
'description', 'contacts', 'tags', 'created', 'last_updated',
|
||||
'asset_tag', 'form_factor', 'u_height', 'starting_unit', 'width', 'outer_width', 'outer_depth',
|
||||
'mounting_depth', 'weight', 'max_weight', 'comments', 'device_count', 'get_utilization',
|
||||
'get_power_utilization', 'description', 'contacts', 'tags', 'created', 'last_updated',
|
||||
)
|
||||
default_columns = (
|
||||
'pk', 'name', 'site', 'location', 'status', 'facility_id', 'tenant', 'role', 'u_height', 'device_count',
|
||||
|
@ -486,7 +486,7 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
manufacturer=manufacturers[0],
|
||||
name='RackType 1',
|
||||
slug='rack-type-1',
|
||||
type=RackTypeChoices.TYPE_2POST,
|
||||
form_factor=RackFormFactorChoices.TYPE_2POST,
|
||||
width=RackWidthChoices.WIDTH_19IN,
|
||||
u_height=42,
|
||||
starting_unit=1,
|
||||
@ -504,7 +504,7 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
manufacturer=manufacturers[1],
|
||||
name='RackType 2',
|
||||
slug='rack-type-2',
|
||||
type=RackTypeChoices.TYPE_4POST,
|
||||
form_factor=RackFormFactorChoices.TYPE_4POST,
|
||||
width=RackWidthChoices.WIDTH_21IN,
|
||||
u_height=43,
|
||||
starting_unit=2,
|
||||
@ -522,7 +522,7 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
manufacturer=manufacturers[2],
|
||||
name='RackType 3',
|
||||
slug='rack-type-3',
|
||||
type=RackTypeChoices.TYPE_CABINET,
|
||||
form_factor=RackFormFactorChoices.TYPE_CABINET,
|
||||
width=RackWidthChoices.WIDTH_23IN,
|
||||
u_height=44,
|
||||
starting_unit=3,
|
||||
@ -562,8 +562,8 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
params = {'description': ['foobar1', 'foobar2']}
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
||||
|
||||
def test_type(self):
|
||||
params = {'type': [RackTypeChoices.TYPE_2POST, RackTypeChoices.TYPE_4POST]}
|
||||
def test_form_factor(self):
|
||||
params = {'form_factor': [RackFormFactorChoices.TYPE_2POST, RackFormFactorChoices.TYPE_4POST]}
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
||||
|
||||
def test_width(self):
|
||||
@ -686,7 +686,7 @@ class RackTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
role=rack_roles[0],
|
||||
serial='ABC',
|
||||
asset_tag='1001',
|
||||
type=RackTypeChoices.TYPE_2POST,
|
||||
form_factor=RackFormFactorChoices.TYPE_2POST,
|
||||
width=RackWidthChoices.WIDTH_19IN,
|
||||
u_height=42,
|
||||
desc_units=False,
|
||||
@ -708,7 +708,7 @@ class RackTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
role=rack_roles[1],
|
||||
serial='DEF',
|
||||
asset_tag='1002',
|
||||
type=RackTypeChoices.TYPE_4POST,
|
||||
form_factor=RackFormFactorChoices.TYPE_4POST,
|
||||
width=RackWidthChoices.WIDTH_21IN,
|
||||
u_height=43,
|
||||
desc_units=False,
|
||||
@ -730,7 +730,7 @@ class RackTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
role=rack_roles[2],
|
||||
serial='GHI',
|
||||
asset_tag='1003',
|
||||
type=RackTypeChoices.TYPE_CABINET,
|
||||
form_factor=RackFormFactorChoices.TYPE_CABINET,
|
||||
width=RackWidthChoices.WIDTH_23IN,
|
||||
u_height=44,
|
||||
desc_units=True,
|
||||
@ -765,8 +765,8 @@ class RackTestCase(TestCase, ChangeLoggedFilterSetTests):
|
||||
params = {'description': ['foobar1', 'foobar2']}
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
||||
|
||||
def test_type(self):
|
||||
params = {'type': [RackTypeChoices.TYPE_2POST, RackTypeChoices.TYPE_4POST]}
|
||||
def test_form_factor(self):
|
||||
params = {'form_factor': [RackFormFactorChoices.TYPE_2POST, RackFormFactorChoices.TYPE_4POST]}
|
||||
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
|
||||
|
||||
def test_width(self):
|
||||
|
@ -360,7 +360,7 @@ class RackTypeTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
'manufacturer': manufacturers[1].pk,
|
||||
'name': 'RackType X',
|
||||
'slug': 'rack-type-x',
|
||||
'type': RackTypeChoices.TYPE_CABINET,
|
||||
'type': RackFormFactorChoices.TYPE_CABINET,
|
||||
'width': RackWidthChoices.WIDTH_19IN,
|
||||
'u_height': 48,
|
||||
'desc_units': False,
|
||||
@ -391,7 +391,7 @@ class RackTypeTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
|
||||
cls.bulk_edit_data = {
|
||||
'manufacturer': manufacturers[1].pk,
|
||||
'type': RackTypeChoices.TYPE_4POST,
|
||||
'type': RackFormFactorChoices.TYPE_4POST,
|
||||
'width': RackWidthChoices.WIDTH_23IN,
|
||||
'u_height': 49,
|
||||
'desc_units': True,
|
||||
@ -449,7 +449,7 @@ class RackTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
'role': rackroles[1].pk,
|
||||
'serial': '123456',
|
||||
'asset_tag': 'ABCDEF',
|
||||
'type': RackTypeChoices.TYPE_CABINET,
|
||||
'form_factor': RackFormFactorChoices.TYPE_CABINET,
|
||||
'width': RackWidthChoices.WIDTH_19IN,
|
||||
'u_height': 48,
|
||||
'desc_units': False,
|
||||
@ -485,7 +485,7 @@ class RackTestCase(ViewTestCases.PrimaryObjectViewTestCase):
|
||||
'status': RackStatusChoices.STATUS_DEPRECATED,
|
||||
'role': rackroles[1].pk,
|
||||
'serial': '654321',
|
||||
'type': RackTypeChoices.TYPE_4POST,
|
||||
'form_factor': RackFormFactorChoices.TYPE_4POST,
|
||||
'width': RackWidthChoices.WIDTH_23IN,
|
||||
'u_height': 49,
|
||||
'desc_units': True,
|
||||
|
@ -73,14 +73,8 @@
|
||||
<h5 class="card-header">{% trans "Dimensions" %}</h5>
|
||||
<table class="table table-hover attr-table">
|
||||
<tr>
|
||||
<th scope="row">{% trans "Type" %}</th>
|
||||
<td>
|
||||
{% if object.type %}
|
||||
{{ object.get_type_display }}
|
||||
{% else %}
|
||||
{{ ''|placeholder }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<th scope="row">{% trans "Form factor" %}</th>
|
||||
<td>{{ object.get_form_factor_display|placeholder }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans "Width" %}</th>
|
||||
|
@ -21,14 +21,8 @@
|
||||
<td>{{ object.name }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans "Type" %}</th>
|
||||
<td>
|
||||
{% if object.type %}
|
||||
{{ object.get_type_display }}
|
||||
{% else %}
|
||||
{{ ''|placeholder }}
|
||||
{% endif %}
|
||||
</td>
|
||||
<th scope="row">{% trans "Form factor" %}</th>
|
||||
<td>{{ object.get_form_factor_display|placeholder }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">{% trans "Description" %}</th>
|
||||
|
Loading…
Reference in New Issue
Block a user