Kaynağa Gözat

Rename Interface type (classification) filter to kind

Jeremy Stretch 6 yıl önce
ebeveyn
işleme
533520ec1f
2 değiştirilmiş dosya ile 10 ekleme ve 5 silme
  1. 6 0
      CHANGELOG.md
  2. 4 5
      netbox/dcim/filters.py

+ 6 - 0
CHANGELOG.md

@@ -56,8 +56,14 @@ to now use "Extras | Tag."
 * [#2324](https://github.com/digitalocean/netbox/issues/2324) - Add `color` option for tags
 * [#2643](https://github.com/digitalocean/netbox/issues/2643) - Add `description` field to console/power components and device bays
 * [#2791](https://github.com/digitalocean/netbox/issues/2791) - Add a `comment` field for tags
+* [#2920](https://github.com/digitalocean/netbox/issues/2920) - Rename Interface `form_factor` to `type`
 * [#2926](https://github.com/digitalocean/netbox/issues/2926) - Add changelog to the Tag model
 
+## API Changes
+
+* dcim.Interface: `form_factor` has been renamed to `type`. Backward-compatibile support for `form_factor` will be maintained until NetBox v2.7.
+* dcim.Interface: The `type` filter has been renamed to `kind`.
+
 ## Bug Fixes
 
 * [#2968](https://github.com/digitalocean/netbox/issues/2968) - Correct API documentation for SerializerMethodFields

+ 4 - 5
netbox/dcim/filters.py

@@ -753,10 +753,9 @@ class InterfaceFilter(django_filters.FilterSet):
         lookup_expr='isnull',
         exclude=True
     )
-    class_ = django_filters.CharFilter(
-        field_name='class',
-        method='filter_type',
-        label='Interface type',
+    kind = django_filters.CharFilter(
+        method='filter_kind',
+        label='Kind of interface',
     )
     lag_id = django_filters.ModelMultipleChoiceFilter(
         field_name='lag',
@@ -819,7 +818,7 @@ class InterfaceFilter(django_filters.FilterSet):
             Q(tagged_vlans__vid=value)
         )
 
-    def filter_type(self, queryset, name, value):
+    def filter_kind(self, queryset, name, value):
         value = value.strip().lower()
         return {
             'physical': queryset.exclude(type__in=NONCONNECTABLE_IFACE_TYPES),