From 976388f29c1d4e8a13a3ea4ec1464bab3e8ded93 Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Mon, 5 Nov 2018 12:02:55 -0500 Subject: [PATCH] Removed 'interface_ordering' field from DeviceType --- netbox/dcim/api/serializers.py | 5 ++--- netbox/dcim/forms.py | 13 ++----------- .../0067_device_type_remove_qualifiers.py | 4 ++++ netbox/dcim/models.py | 8 +------- netbox/templates/dcim/devicetype.html | 4 ---- netbox/templates/dcim/devicetype_edit.html | 1 - 6 files changed, 9 insertions(+), 26 deletions(-) diff --git a/netbox/dcim/api/serializers.py b/netbox/dcim/api/serializers.py index e86a4549db0..882e1231057 100644 --- a/netbox/dcim/api/serializers.py +++ b/netbox/dcim/api/serializers.py @@ -220,7 +220,6 @@ class Meta: class DeviceTypeSerializer(TaggitSerializer, CustomFieldModelSerializer): manufacturer = NestedManufacturerSerializer() - interface_ordering = ChoiceField(choices=IFACE_ORDERING_CHOICES, required=False) subdevice_role = ChoiceField(choices=SUBDEVICE_ROLE_CHOICES, required=False, allow_null=True) instance_count = serializers.IntegerField(source='instances.count', read_only=True) tags = TagListSerializerField(required=False) @@ -228,8 +227,8 @@ class DeviceTypeSerializer(TaggitSerializer, CustomFieldModelSerializer): class Meta: model = DeviceType fields = [ - 'id', 'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'interface_ordering', - 'subdevice_role', 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'instance_count', + 'id', 'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', + 'comments', 'tags', 'custom_fields', 'created', 'last_updated', 'instance_count', ] diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index 52f04ccff2f..e5c97c4a2c5 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -605,12 +605,9 @@ class DeviceTypeForm(BootstrapMixin, CustomFieldForm): class Meta: model = DeviceType fields = [ - 'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', - 'interface_ordering', 'comments', 'tags', + 'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', 'comments', + 'tags', ] - labels = { - 'interface_ordering': 'Order interfaces by', - } class DeviceTypeCSVForm(forms.ModelForm): @@ -628,11 +625,6 @@ class DeviceTypeCSVForm(forms.ModelForm): required=False, help_text='Parent/child status' ) - interface_ordering = CSVChoiceField( - choices=IFACE_ORDERING_CHOICES, - required=False, - help_text='Interface ordering' - ) class Meta: model = DeviceType @@ -648,7 +640,6 @@ class DeviceTypeBulkEditForm(BootstrapMixin, AddRemoveTagsForm, CustomFieldBulkE manufacturer = forms.ModelChoiceField(queryset=Manufacturer.objects.all(), required=False) u_height = forms.IntegerField(min_value=1, required=False) is_full_depth = forms.NullBooleanField(required=False, widget=BulkEditNullBooleanSelect, label='Is full depth') - interface_ordering = forms.ChoiceField(choices=add_blank_choice(IFACE_ORDERING_CHOICES), required=False) class Meta: nullable_fields = [] diff --git a/netbox/dcim/migrations/0067_device_type_remove_qualifiers.py b/netbox/dcim/migrations/0067_device_type_remove_qualifiers.py index 883f863fc69..e78ccd8b6cd 100644 --- a/netbox/dcim/migrations/0067_device_type_remove_qualifiers.py +++ b/netbox/dcim/migrations/0067_device_type_remove_qualifiers.py @@ -22,4 +22,8 @@ class Migration(migrations.Migration): model_name='devicetype', name='is_pdu', ), + migrations.RemoveField( + model_name='devicetype', + name='interface_ordering', + ), ] diff --git a/netbox/dcim/models.py b/netbox/dcim/models.py index 95f17fb37bd..e332dafd25b 100644 --- a/netbox/dcim/models.py +++ b/netbox/dcim/models.py @@ -859,10 +859,6 @@ class DeviceType(ChangeLoggedModel, CustomFieldModel): verbose_name='Is full depth', help_text='Device consumes both front and rear rack faces' ) - interface_ordering = models.PositiveSmallIntegerField( - choices=IFACE_ORDERING_CHOICES, - default=IFACE_ORDERING_POSITION - ) subdevice_role = models.NullBooleanField( default=None, verbose_name='Parent/child status', @@ -882,8 +878,7 @@ class DeviceType(ChangeLoggedModel, CustomFieldModel): tags = TaggableManager() csv_headers = [ - 'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', - 'interface_ordering', 'comments', + 'manufacturer', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', 'comments', ] class Meta: @@ -914,7 +909,6 @@ def to_csv(self): self.u_height, self.is_full_depth, self.get_subdevice_role_display() if self.subdevice_role else None, - self.get_interface_ordering_display(), self.comments, ) diff --git a/netbox/templates/dcim/devicetype.html b/netbox/templates/dcim/devicetype.html index 89225e7e6ea..1719e8f66d2 100644 --- a/netbox/templates/dcim/devicetype.html +++ b/netbox/templates/dcim/devicetype.html @@ -108,10 +108,6 @@

{{ devicetype.manufacturer }} {{ devicetype.model }}

{% endif %} - - Interface Ordering - {{ devicetype.get_interface_ordering_display }} - Instances {{ devicetype.instances.count }} diff --git a/netbox/templates/dcim/devicetype_edit.html b/netbox/templates/dcim/devicetype_edit.html index 0d54e069843..3c22eb9cde6 100644 --- a/netbox/templates/dcim/devicetype_edit.html +++ b/netbox/templates/dcim/devicetype_edit.html @@ -11,7 +11,6 @@ {% render_field form.part_number %} {% render_field form.u_height %} {% render_field form.is_full_depth %} - {% render_field form.interface_ordering %} {% render_field form.subdevice_role %}