12826 remove role

This commit is contained in:
Arthur Hanson 2024-06-25 10:15:38 -07:00
parent 1800e49f65
commit c8a5197b2c
6 changed files with 7 additions and 45 deletions

View File

@ -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')

View File

@ -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',
)

View File

@ -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',
]

View File

@ -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={

View File

@ -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,

View File

@ -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',
)