Skip to content

Commit

Permalink
Removed 'interface_ordering' field from DeviceType
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Nov 5, 2018
1 parent e5f1210 commit 976388f
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 26 deletions.
5 changes: 2 additions & 3 deletions netbox/dcim/api/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,16 +220,15 @@ 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)

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


Expand Down
13 changes: 2 additions & 11 deletions netbox/dcim/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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
Expand All @@ -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 = []
Expand Down
4 changes: 4 additions & 0 deletions netbox/dcim/migrations/0067_device_type_remove_qualifiers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,8 @@ class Migration(migrations.Migration):
model_name='devicetype',
name='is_pdu',
),
migrations.RemoveField(
model_name='devicetype',
name='interface_ordering',
),
]
8 changes: 1 addition & 7 deletions netbox/dcim/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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:
Expand Down Expand Up @@ -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,
)

Expand Down
4 changes: 0 additions & 4 deletions netbox/templates/dcim/devicetype.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,6 @@ <h1>{{ devicetype.manufacturer }} {{ devicetype.model }}</h1>
{% 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>
Expand Down
1 change: 0 additions & 1 deletion netbox/templates/dcim/devicetype_edit.html
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit 976388f

Please sign in to comment.