11969 remove airflow from racktype

This commit is contained in:
Arthur Hanson 2024-08-30 08:54:36 -07:00
parent af93b47f94
commit 18ea7a850a
9 changed files with 14 additions and 36 deletions

View File

@ -75,7 +75,7 @@ class RackTypeSerializer(RackBaseSerializer):
fields = [
'id', 'url', 'display_url', 'display', 'manufacturer', 'model', 'slug', 'description', 'form_factor',
'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'weight',
'max_weight', 'weight_unit', 'mounting_depth', 'airflow', 'description', 'comments', 'tags',
'max_weight', 'weight_unit', 'mounting_depth', 'description', 'comments', 'tags',
'custom_fields', 'created', 'last_updated',
]
brief_fields = ('id', 'url', 'display', 'manufacturer', 'model', 'slug', 'description')

View File

@ -312,7 +312,7 @@ class RackTypeFilterSet(NetBoxModelFilterSet):
model = RackType
fields = (
'id', 'model', 'slug', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit',
'mounting_depth', 'airflow', 'weight', 'max_weight', 'weight_unit', 'description',
'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description',
)
def search(self, queryset, name, value):

View File

@ -268,11 +268,6 @@ class RackTypeBulkEditForm(NetBoxModelBulkEditForm):
required=False,
min_value=1
)
airflow = forms.ChoiceField(
label=_('Airflow'),
choices=add_blank_choice(RackAirflowChoices),
required=False
)
weight = forms.DecimalField(
label=_('Weight'),
min_value=0,
@ -298,7 +293,7 @@ class RackTypeBulkEditForm(NetBoxModelBulkEditForm):
model = RackType
fieldsets = (
FieldSet('manufacturer', 'description', 'form_factor', 'width', 'u_height', 'airflow', name=_('Rack Type')),
FieldSet('manufacturer', 'description', 'form_factor', 'width', 'u_height', name=_('Rack Type')),
FieldSet(
InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')),
InlineFields('weight', 'max_weight', 'weight_unit', label=_('Weight')),

View File

@ -206,12 +206,6 @@ class RackTypeImportForm(NetBoxModelImportForm):
required=False,
help_text=_('Unit for outer dimensions')
)
airflow = CSVChoiceField(
label=_('Airflow'),
choices=RackAirflowChoices,
required=False,
help_text=_('Airflow direction')
)
weight_unit = CSVChoiceField(
label=_('Weight unit'),
choices=WeightUnitChoices,
@ -223,7 +217,7 @@ class RackTypeImportForm(NetBoxModelImportForm):
model = RackType
fields = (
'manufacturer', 'model', 'slug', 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units',
'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'airflow', 'weight', 'max_weight',
'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight',
'weight_unit', 'description', 'comments', 'tags',
)

View File

@ -302,7 +302,7 @@ class RackTypeFilterForm(RackBaseFilterForm):
model = RackType
fieldsets = (
FieldSet('q', 'filter_id', 'tag'),
FieldSet('form_factor', 'width', 'u_height', 'airflow', name=_('Rack Type')),
FieldSet('form_factor', 'width', 'u_height', name=_('Rack Type')),
FieldSet('starting_unit', 'desc_units', name=_('Numbering')),
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
)

View File

@ -214,7 +214,7 @@ class RackTypeForm(NetBoxModelForm):
)
fieldsets = (
FieldSet('manufacturer', 'model', 'slug', 'description', 'form_factor', 'airflow', 'tags', name=_('Rack Type')),
FieldSet('manufacturer', 'model', 'slug', 'description', 'form_factor', 'tags', name=_('Rack Type')),
FieldSet(
'width', 'u_height',
InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')),
@ -229,7 +229,7 @@ class RackTypeForm(NetBoxModelForm):
fields = [
'manufacturer', 'model', 'slug', 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units',
'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit',
'airflow', 'description', 'comments', 'tags',
'description', 'comments', 'tags',
]

View File

@ -20,9 +20,4 @@ class Migration(migrations.Migration):
name='airflow',
field=models.CharField(blank=True, max_length=50),
),
migrations.AddField(
model_name='racktype',
name='airflow',
field=models.CharField(blank=True, max_length=50),
),
]

View File

@ -53,12 +53,6 @@ class RackBase(WeightMixin, PrimaryModel):
verbose_name=_('width'),
help_text=_('Rail-to-rail width')
)
airflow = models.CharField(
verbose_name=_('airflow'),
max_length=50,
choices=RackAirflowChoices,
blank=True
)
# Numbering
u_height = models.PositiveSmallIntegerField(
@ -147,7 +141,7 @@ class RackType(RackBase):
)
clone_fields = (
'manufacturer', 'form_factor', 'width', 'u_height', 'airflow', 'desc_units', 'outer_width', 'outer_depth',
'manufacturer', 'form_factor', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth',
'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit',
)
prerequisite_models = (
@ -321,6 +315,12 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, RackBase):
verbose_name=_('asset tag'),
help_text=_('A unique tag used to identify this rack')
)
airflow = models.CharField(
verbose_name=_('airflow'),
max_length=50,
choices=RackAirflowChoices,
blank=True
)
# Generic relations
vlan_groups = GenericRelation(

View File

@ -501,7 +501,6 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
max_weight=1000,
weight_unit=WeightUnitChoices.UNIT_POUND,
description='foobar1',
airflow=RackAirflowChoices.FRONT_TO_REAR
),
RackType(
manufacturer=manufacturers[1],
@ -520,7 +519,6 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
max_weight=2000,
weight_unit=WeightUnitChoices.UNIT_POUND,
description='foobar2',
airflow=RackAirflowChoices.REAR_TO_FRONT
),
RackType(
manufacturer=manufacturers[2],
@ -617,10 +615,6 @@ class RackTypeTestCase(TestCase, ChangeLoggedFilterSetTests):
params = {'weight_unit': WeightUnitChoices.UNIT_POUND}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 2)
def test_airflow(self):
params = {'airflow': RackAirflowChoices.REAR_TO_FRONT}
self.assertEqual(self.filterset(params, self.queryset).qs.count(), 1)
class RackTestCase(TestCase, ChangeLoggedFilterSetTests):
queryset = Rack.objects.all()