From c8a5197b2c1c3e490726ff2a9a24bf1d3cd5d99a Mon Sep 17 00:00:00 2001 From: Arthur Hanson Date: Tue, 25 Jun 2024 10:15:38 -0700 Subject: [PATCH] 12826 remove role --- netbox/dcim/forms/bulk_edit.py | 7 +------ netbox/dcim/forms/bulk_import.py | 9 +-------- netbox/dcim/forms/model_forms.py | 11 +++-------- netbox/dcim/migrations/0188_racktype.py | 10 ---------- netbox/dcim/models/racks.py | 8 -------- netbox/dcim/tables/racks.py | 7 ++----- 6 files changed, 7 insertions(+), 45 deletions(-) diff --git a/netbox/dcim/forms/bulk_edit.py b/netbox/dcim/forms/bulk_edit.py index 964749ad5..3f8258299 100644 --- a/netbox/dcim/forms/bulk_edit.py +++ b/netbox/dcim/forms/bulk_edit.py @@ -220,11 +220,6 @@ class RackRoleBulkEditForm(NetBoxModelBulkEditForm): class RackTypeBulkEditForm(NetBoxModelBulkEditForm): - role = DynamicModelChoiceField( - label=_('Role'), - queryset=RackRole.objects.all(), - required=False - ) type = forms.ChoiceField( label=_('Type'), choices=add_blank_choice(RackTypeChoices), @@ -289,7 +284,7 @@ class RackTypeBulkEditForm(NetBoxModelBulkEditForm): model = Rack fieldsets = ( - FieldSet('role', 'description', name=_('Rack')), + FieldSet('description', name=_('Rack')), FieldSet( 'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', name=_('Hardware') diff --git a/netbox/dcim/forms/bulk_import.py b/netbox/dcim/forms/bulk_import.py index 1440cc102..86d65a6be 100644 --- a/netbox/dcim/forms/bulk_import.py +++ b/netbox/dcim/forms/bulk_import.py @@ -181,13 +181,6 @@ class RackRoleImportForm(NetBoxModelImportForm): class RackTypeImportForm(NetBoxModelImportForm): - role = CSVModelChoiceField( - label=_('Role'), - queryset=RackRole.objects.all(), - required=False, - to_field_name='name', - help_text=_('Name of assigned role') - ) type = CSVChoiceField( label=_('Type'), choices=RackTypeChoices, @@ -215,7 +208,7 @@ class RackTypeImportForm(NetBoxModelImportForm): class Meta: model = RackType fields = ( - 'name', 'role', 'type', + 'name', 'type', 'width', 'u_height', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description', 'comments', 'tags', ) diff --git a/netbox/dcim/forms/model_forms.py b/netbox/dcim/forms/model_forms.py index f6ab0c1bf..39c1ecb79 100644 --- a/netbox/dcim/forms/model_forms.py +++ b/netbox/dcim/forms/model_forms.py @@ -203,15 +203,10 @@ class RackRoleForm(NetBoxModelForm): class RackTypeForm(NetBoxModelForm): - role = DynamicModelChoiceField( - label=_('Role'), - queryset=RackRole.objects.all(), - required=False - ) comments = CommentField() fieldsets = ( - FieldSet('name', 'status', 'role', 'description', 'tags', name=_('Rack')), + FieldSet('name', 'description', 'tags', name=_('Rack')), FieldSet( 'type', 'width', 'starting_unit', 'u_height', InlineFields('outer_width', 'outer_depth', 'outer_unit', label=_('Outer Dimensions')), @@ -221,9 +216,9 @@ class RackTypeForm(NetBoxModelForm): ) class Meta: - model = Rack + model = RackType fields = [ - 'name', 'role', + 'name', 'type', 'width', 'u_height', 'starting_unit', 'desc_units', 'outer_width', 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description', 'comments', 'tags', ] diff --git a/netbox/dcim/migrations/0188_racktype.py b/netbox/dcim/migrations/0188_racktype.py index 4f6e1ec49..5a1373c35 100644 --- a/netbox/dcim/migrations/0188_racktype.py +++ b/netbox/dcim/migrations/0188_racktype.py @@ -64,16 +64,6 @@ class Migration(migrations.Migration): ('max_weight', models.PositiveIntegerField(blank=True, null=True)), ('_abs_max_weight', models.PositiveBigIntegerField(blank=True, null=True)), ('mounting_depth', models.PositiveSmallIntegerField(blank=True, null=True)), - ( - 'role', - models.ForeignKey( - blank=True, - null=True, - on_delete=django.db.models.deletion.PROTECT, - related_name='racktypes', - to='dcim.rackrole', - ), - ), ('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')), ], options={ diff --git a/netbox/dcim/models/racks.py b/netbox/dcim/models/racks.py index d68fdadb0..69ec058f7 100644 --- a/netbox/dcim/models/racks.py +++ b/netbox/dcim/models/racks.py @@ -51,14 +51,6 @@ class RackType(ImageAttachmentsMixin, PrimaryModel, WeightMixin): max_length=100, blank=True ) - role = models.ForeignKey( - to='dcim.RackRole', - on_delete=models.PROTECT, - related_name='racktypes', - blank=True, - null=True, - help_text=_('Functional role') - ) type = models.CharField( choices=RackTypeChoices, max_length=50, diff --git a/netbox/dcim/tables/racks.py b/netbox/dcim/tables/racks.py index 4da1a3db2..ef7d8779c 100644 --- a/netbox/dcim/tables/racks.py +++ b/netbox/dcim/tables/racks.py @@ -55,9 +55,6 @@ class RackTypeTable(NetBoxTable): order_by=('_name',), linkify=True ) - role = columns.ColoredLabelColumn( - verbose_name=_('Role'), - ) u_height = tables.TemplateColumn( template_code="{{ value }}U", verbose_name=_('Height') @@ -90,13 +87,13 @@ class RackTypeTable(NetBoxTable): class Meta(NetBoxTable.Meta): model = RackType fields = ( - 'pk', 'id', 'name', 'role', + 'pk', 'id', 'name', 'type', 'u_height', 'starting_unit', 'width', 'outer_width', 'outer_depth', 'mounting_depth', 'weight', 'max_weight', 'comments', 'description', 'tags', 'created', 'last_updated', ) default_columns = ( - 'pk', 'name', 'role', 'u_height', + 'pk', 'name', 'u_height', )