diff --git a/docs/models/dcim/racktype.md b/docs/models/dcim/racktype.md index 04dd63eee..eeb90bd29 100644 --- a/docs/models/dcim/racktype.md +++ b/docs/models/dcim/racktype.md @@ -59,8 +59,3 @@ The maximum total weight capacity for all installed devices, inclusive of the ra ### Descending Units If selected, the rack's elevation will display unit 1 at the top of the rack. (Most racks use ascending numbering, with unit 1 assigned to the bottommost position.) - -### Airflow - -The direction in which air circulates through the rack for cooling. - diff --git a/netbox/dcim/api/serializers_/racks.py b/netbox/dcim/api/serializers_/racks.py index 4a0fe5daa..ee76b09ce 100644 --- a/netbox/dcim/api/serializers_/racks.py +++ b/netbox/dcim/api/serializers_/racks.py @@ -64,18 +64,13 @@ class RackTypeSerializer(RackBaseSerializer): manufacturer = ManufacturerSerializer( nested=True ) - airflow = ChoiceField( - choices=RackAirflowChoices, - allow_blank=True, - required=False - ) class Meta: model = RackType 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') diff --git a/netbox/dcim/filtersets.py b/netbox/dcim/filtersets.py index 835fac9c3..6517aadb4 100644 --- a/netbox/dcim/filtersets.py +++ b/netbox/dcim/filtersets.py @@ -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): diff --git a/netbox/dcim/forms/bulk_edit.py b/netbox/dcim/forms/bulk_edit.py index eade09a7a..96036f4da 100644 --- a/netbox/dcim/forms/bulk_edit.py +++ b/netbox/dcim/forms/bulk_edit.py @@ -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')), diff --git a/netbox/dcim/forms/bulk_import.py b/netbox/dcim/forms/bulk_import.py index 2e537d978..9b4a8475b 100644 --- a/netbox/dcim/forms/bulk_import.py +++ b/netbox/dcim/forms/bulk_import.py @@ -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', ) diff --git a/netbox/dcim/forms/filtersets.py b/netbox/dcim/forms/filtersets.py index d7372bde6..e2b6fda07 100644 --- a/netbox/dcim/forms/filtersets.py +++ b/netbox/dcim/forms/filtersets.py @@ -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')), ) diff --git a/netbox/dcim/forms/model_forms.py b/netbox/dcim/forms/model_forms.py index d1ea12d4b..7dc6d5239 100644 --- a/netbox/dcim/forms/model_forms.py +++ b/netbox/dcim/forms/model_forms.py @@ -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', ] @@ -261,7 +261,7 @@ class RackForm(TenancyForm, NetBoxModelForm): comments = CommentField() fieldsets = ( - FieldSet('site', 'location', 'name', 'status', 'role', 'rack_type', 'description', 'tags', name=_('Rack')), + FieldSet('site', 'location', 'name', 'status', 'role', 'rack_type', 'description', 'airflow', 'tags', name=_('Rack')), FieldSet('facility_id', 'serial', 'asset_tag', name=_('Inventory Control')), FieldSet('tenant_group', 'tenant', name=_('Tenancy')), ) @@ -293,7 +293,7 @@ class RackForm(TenancyForm, NetBoxModelForm): self.fieldsets = ( *self.fieldsets, FieldSet( - 'form_factor', 'width', 'starting_unit', 'u_height', 'airflow', + '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') diff --git a/netbox/dcim/migrations/0189_moduletype_airflow_rack_airflow_racktype_airflow.py b/netbox/dcim/migrations/0189_moduletype_rack_airflow.py similarity index 69% rename from netbox/dcim/migrations/0189_moduletype_airflow_rack_airflow_racktype_airflow.py rename to netbox/dcim/migrations/0189_moduletype_rack_airflow.py index 370df90e8..31787b67d 100644 --- a/netbox/dcim/migrations/0189_moduletype_airflow_rack_airflow_racktype_airflow.py +++ b/netbox/dcim/migrations/0189_moduletype_rack_airflow.py @@ -1,5 +1,3 @@ -# Generated by Django 5.0.7 on 2024-07-25 07:00 - from django.db import migrations, models @@ -20,9 +18,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), - ), ] diff --git a/netbox/dcim/migrations/0190_nested_modules.py b/netbox/dcim/migrations/0190_nested_modules.py index f5f5f0723..9cef40efb 100644 --- a/netbox/dcim/migrations/0190_nested_modules.py +++ b/netbox/dcim/migrations/0190_nested_modules.py @@ -6,7 +6,7 @@ from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ - ('dcim', '0189_moduletype_airflow_rack_airflow_racktype_airflow'), + ('dcim', '0189_moduletype_rack_airflow'), ('extras', '0121_customfield_related_object_filter'), ] diff --git a/netbox/dcim/models/racks.py b/netbox/dcim/models/racks.py index 68088b63a..6a2dba542 100644 --- a/netbox/dcim/models/racks.py +++ b/netbox/dcim/models/racks.py @@ -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 = ( @@ -248,7 +242,7 @@ class Rack(ContactsMixin, ImageAttachmentsMixin, RackBase): """ # Fields which cannot be set locally if a RackType is assigned RACKTYPE_FIELDS = ( - 'form_factor', 'width', 'airflow', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', + 'form_factor', 'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'weight_unit', 'max_weight', ) @@ -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( diff --git a/netbox/dcim/tests/test_filtersets.py b/netbox/dcim/tests/test_filtersets.py index 46f2ebc2a..e2d52a609 100644 --- a/netbox/dcim/tests/test_filtersets.py +++ b/netbox/dcim/tests/test_filtersets.py @@ -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()