Просмотр исходного кода

Removed 'interface_ordering' field from DeviceType

Jeremy Stretch 7 лет назад
Родитель
Сommit
976388f29c

+ 2 - 3
netbox/dcim/api/serializers.py

@@ -220,7 +220,6 @@ class NestedManufacturerSerializer(WritableNestedSerializer):
 
 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',
         ]
 
 

+ 2 - 11
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 = []

+ 4 - 0
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',
+        ),
     ]

+ 1 - 7
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 @@ class DeviceType(ChangeLoggedModel, CustomFieldModel):
             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,
         )
 

+ 0 - 4
netbox/templates/dcim/devicetype.html

@@ -108,10 +108,6 @@
                         {% endif %}
                     </td>
                 </tr>
-                <tr>
-                    <td>Interface Ordering</td>
-                    <td>{{ devicetype.get_interface_ordering_display }}</td>
-                </tr>
                 <tr>
                     <td>Instances</td>
                     <td><a href="{% url 'dcim:device_list' %}?device_type_id={{ devicetype.pk }}">{{ devicetype.instances.count }}</a></td>

+ 0 - 1
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 %}
         </div>
     </div>