|
|
@@ -325,7 +325,7 @@ class RackFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSe
|
|
|
model = Rack
|
|
|
fields = [
|
|
|
'id', 'name', 'facility_id', 'asset_tag', 'u_height', 'starting_unit', 'desc_units', 'outer_width',
|
|
|
- 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit'
|
|
|
+ 'outer_depth', 'outer_unit', 'mounting_depth', 'weight', 'max_weight', 'weight_unit', 'description',
|
|
|
]
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
|
@@ -336,6 +336,7 @@ class RackFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSe
|
|
|
Q(facility_id__icontains=value) |
|
|
|
Q(serial__icontains=value.strip()) |
|
|
|
Q(asset_tag__icontains=value.strip()) |
|
|
|
+ Q(description__icontains=value) |
|
|
|
Q(comments__icontains=value)
|
|
|
)
|
|
|
|
|
|
@@ -497,7 +498,8 @@ class DeviceTypeFilterSet(NetBoxModelFilterSet):
|
|
|
class Meta:
|
|
|
model = DeviceType
|
|
|
fields = [
|
|
|
- 'id', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', 'airflow', 'weight', 'weight_unit',
|
|
|
+ 'id', 'model', 'slug', 'part_number', 'u_height', 'is_full_depth', 'subdevice_role', 'airflow', 'weight',
|
|
|
+ 'weight_unit', 'description',
|
|
|
]
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
|
@@ -507,6 +509,7 @@ class DeviceTypeFilterSet(NetBoxModelFilterSet):
|
|
|
Q(manufacturer__name__icontains=value) |
|
|
|
Q(model__icontains=value) |
|
|
|
Q(part_number__icontains=value) |
|
|
|
+ Q(description__icontains=value) |
|
|
|
Q(comments__icontains=value)
|
|
|
)
|
|
|
|
|
|
@@ -591,7 +594,7 @@ class ModuleTypeFilterSet(NetBoxModelFilterSet):
|
|
|
|
|
|
class Meta:
|
|
|
model = ModuleType
|
|
|
- fields = ['id', 'model', 'part_number', 'weight', 'weight_unit']
|
|
|
+ fields = ['id', 'model', 'part_number', 'weight', 'weight_unit', 'description']
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
|
@@ -600,6 +603,7 @@ class ModuleTypeFilterSet(NetBoxModelFilterSet):
|
|
|
Q(manufacturer__name__icontains=value) |
|
|
|
Q(model__icontains=value) |
|
|
|
Q(part_number__icontains=value) |
|
|
|
+ Q(description__icontains=value) |
|
|
|
Q(comments__icontains=value)
|
|
|
)
|
|
|
|
|
|
@@ -639,7 +643,10 @@ class DeviceTypeComponentFilterSet(django_filters.FilterSet):
|
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
|
return queryset
|
|
|
- return queryset.filter(name__icontains=value)
|
|
|
+ return queryset.filter(
|
|
|
+ Q(name__icontains=value) |
|
|
|
+ Q(description__icontains=value)
|
|
|
+ )
|
|
|
|
|
|
|
|
|
class ModularDeviceTypeComponentFilterSet(DeviceTypeComponentFilterSet):
|
|
|
@@ -654,21 +661,21 @@ class ConsolePortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceType
|
|
|
|
|
|
class Meta:
|
|
|
model = ConsolePortTemplate
|
|
|
- fields = ['id', 'name', 'type']
|
|
|
+ fields = ['id', 'name', 'type', 'description']
|
|
|
|
|
|
|
|
|
class ConsoleServerPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
|
|
|
|
class Meta:
|
|
|
model = ConsoleServerPortTemplate
|
|
|
- fields = ['id', 'name', 'type']
|
|
|
+ fields = ['id', 'name', 'type', 'description']
|
|
|
|
|
|
|
|
|
class PowerPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
|
|
|
|
class Meta:
|
|
|
model = PowerPortTemplate
|
|
|
- fields = ['id', 'name', 'type', 'maximum_draw', 'allocated_draw']
|
|
|
+ fields = ['id', 'name', 'type', 'maximum_draw', 'allocated_draw', 'description']
|
|
|
|
|
|
|
|
|
class PowerOutletTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
|
@@ -679,7 +686,7 @@ class PowerOutletTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceType
|
|
|
|
|
|
class Meta:
|
|
|
model = PowerOutletTemplate
|
|
|
- fields = ['id', 'name', 'type', 'feed_leg']
|
|
|
+ fields = ['id', 'name', 'type', 'feed_leg', 'description']
|
|
|
|
|
|
|
|
|
class InterfaceTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
|
@@ -703,7 +710,7 @@ class InterfaceTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeCo
|
|
|
|
|
|
class Meta:
|
|
|
model = InterfaceTemplate
|
|
|
- fields = ['id', 'name', 'type', 'enabled', 'mgmt_only']
|
|
|
+ fields = ['id', 'name', 'type', 'enabled', 'mgmt_only', 'description']
|
|
|
|
|
|
|
|
|
class FrontPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
|
@@ -714,7 +721,7 @@ class FrontPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeCo
|
|
|
|
|
|
class Meta:
|
|
|
model = FrontPortTemplate
|
|
|
- fields = ['id', 'name', 'type', 'color']
|
|
|
+ fields = ['id', 'name', 'type', 'color', 'description']
|
|
|
|
|
|
|
|
|
class RearPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeComponentFilterSet):
|
|
|
@@ -725,21 +732,21 @@ class RearPortTemplateFilterSet(ChangeLoggedModelFilterSet, ModularDeviceTypeCom
|
|
|
|
|
|
class Meta:
|
|
|
model = RearPortTemplate
|
|
|
- fields = ['id', 'name', 'type', 'color', 'positions']
|
|
|
+ fields = ['id', 'name', 'type', 'color', 'positions', 'description']
|
|
|
|
|
|
|
|
|
class ModuleBayTemplateFilterSet(ChangeLoggedModelFilterSet, DeviceTypeComponentFilterSet):
|
|
|
|
|
|
class Meta:
|
|
|
model = ModuleBayTemplate
|
|
|
- fields = ['id', 'name']
|
|
|
+ fields = ['id', 'name', 'description']
|
|
|
|
|
|
|
|
|
class DeviceBayTemplateFilterSet(ChangeLoggedModelFilterSet, DeviceTypeComponentFilterSet):
|
|
|
|
|
|
class Meta:
|
|
|
model = DeviceBayTemplate
|
|
|
- fields = ['id', 'name']
|
|
|
+ fields = ['id', 'name', 'description']
|
|
|
|
|
|
|
|
|
class InventoryItemTemplateFilterSet(ChangeLoggedModelFilterSet, DeviceTypeComponentFilterSet):
|
|
|
@@ -772,7 +779,7 @@ class InventoryItemTemplateFilterSet(ChangeLoggedModelFilterSet, DeviceTypeCompo
|
|
|
|
|
|
class Meta:
|
|
|
model = InventoryItemTemplate
|
|
|
- fields = ['id', 'name', 'label', 'part_id']
|
|
|
+ fields = ['id', 'name', 'label', 'part_id', 'description']
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
|
@@ -1008,7 +1015,10 @@ class DeviceFilterSet(
|
|
|
|
|
|
class Meta:
|
|
|
model = Device
|
|
|
- fields = ['id', 'asset_tag', 'face', 'position', 'latitude', 'longitude', 'airflow', 'vc_position', 'vc_priority']
|
|
|
+ fields = [
|
|
|
+ 'id', 'asset_tag', 'face', 'position', 'latitude', 'longitude', 'airflow', 'vc_position', 'vc_priority',
|
|
|
+ 'description',
|
|
|
+ ]
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
|
@@ -1088,13 +1098,16 @@ class VirtualDeviceContextFilterSet(NetBoxModelFilterSet, TenancyFilterSet, Prim
|
|
|
|
|
|
class Meta:
|
|
|
model = VirtualDeviceContext
|
|
|
- fields = ['id', 'device', 'name']
|
|
|
+ fields = ['id', 'device', 'name', 'description']
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
|
return queryset
|
|
|
|
|
|
- qs_filter = Q(name__icontains=value)
|
|
|
+ qs_filter = (
|
|
|
+ Q(name__icontains=value) |
|
|
|
+ Q(description__icontains=value)
|
|
|
+ )
|
|
|
try:
|
|
|
qs_filter |= Q(identifier=int(value))
|
|
|
except ValueError:
|
|
|
@@ -1151,7 +1164,7 @@ class ModuleFilterSet(NetBoxModelFilterSet):
|
|
|
|
|
|
class Meta:
|
|
|
model = Module
|
|
|
- fields = ['id', 'status', 'asset_tag']
|
|
|
+ fields = ['id', 'status', 'asset_tag', 'description']
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
|
@@ -1160,6 +1173,7 @@ class ModuleFilterSet(NetBoxModelFilterSet):
|
|
|
Q(device__name__icontains=value.strip()) |
|
|
|
Q(serial__icontains=value.strip()) |
|
|
|
Q(asset_tag__icontains=value.strip()) |
|
|
|
+ Q(description__icontains=value) |
|
|
|
Q(comments__icontains=value)
|
|
|
).distinct()
|
|
|
|
|
|
@@ -1650,7 +1664,7 @@ class InventoryItemRoleFilterSet(OrganizationalModelFilterSet):
|
|
|
|
|
|
class Meta:
|
|
|
model = InventoryItemRole
|
|
|
- fields = ['id', 'name', 'slug', 'color']
|
|
|
+ fields = ['id', 'name', 'slug', 'color', 'description']
|
|
|
|
|
|
|
|
|
class VirtualChassisFilterSet(NetBoxModelFilterSet):
|
|
|
@@ -1715,13 +1729,14 @@ class VirtualChassisFilterSet(NetBoxModelFilterSet):
|
|
|
|
|
|
class Meta:
|
|
|
model = VirtualChassis
|
|
|
- fields = ['id', 'domain', 'name']
|
|
|
+ fields = ['id', 'domain', 'name', 'description']
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
|
return queryset
|
|
|
qs_filter = (
|
|
|
Q(name__icontains=value) |
|
|
|
+ Q(description__icontains=value) |
|
|
|
Q(members__name__icontains=value) |
|
|
|
Q(domain__icontains=value)
|
|
|
)
|
|
|
@@ -1790,12 +1805,16 @@ class CableFilterSet(TenancyFilterSet, NetBoxModelFilterSet):
|
|
|
|
|
|
class Meta:
|
|
|
model = Cable
|
|
|
- fields = ['id', 'label', 'length', 'length_unit']
|
|
|
+ fields = ['id', 'label', 'length', 'length_unit', 'description']
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
|
return queryset
|
|
|
- return queryset.filter(label__icontains=value)
|
|
|
+ qs_filter = (
|
|
|
+ Q(label__icontains=value) |
|
|
|
+ Q(description__icontains=value)
|
|
|
+ )
|
|
|
+ return queryset.filter(qs_filter)
|
|
|
|
|
|
def filter_by_termination(self, queryset, name, value):
|
|
|
# Filter by a related object cached on CableTermination. Note the underscore preceding the field name.
|
|
|
@@ -1882,13 +1901,14 @@ class PowerPanelFilterSet(NetBoxModelFilterSet, ContactModelFilterSet):
|
|
|
|
|
|
class Meta:
|
|
|
model = PowerPanel
|
|
|
- fields = ['id', 'name']
|
|
|
+ fields = ['id', 'name', 'description']
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
|
if not value.strip():
|
|
|
return queryset
|
|
|
qs_filter = (
|
|
|
- Q(name__icontains=value)
|
|
|
+ Q(name__icontains=value) |
|
|
|
+ Q(description__icontains=value)
|
|
|
)
|
|
|
return queryset.filter(qs_filter)
|
|
|
|
|
|
@@ -1949,6 +1969,7 @@ class PowerFeedFilterSet(NetBoxModelFilterSet, CabledObjectFilterSet, PathEndpoi
|
|
|
model = PowerFeed
|
|
|
fields = [
|
|
|
'id', 'name', 'status', 'type', 'supply', 'phase', 'voltage', 'amperage', 'max_utilization', 'cable_end',
|
|
|
+ 'description',
|
|
|
]
|
|
|
|
|
|
def search(self, queryset, name, value):
|
|
|
@@ -1956,6 +1977,7 @@ class PowerFeedFilterSet(NetBoxModelFilterSet, CabledObjectFilterSet, PathEndpoi
|
|
|
return queryset
|
|
|
qs_filter = (
|
|
|
Q(name__icontains=value) |
|
|
|
+ Q(description__icontains=value) |
|
|
|
Q(power_panel__name__icontains=value) |
|
|
|
Q(comments__icontains=value)
|
|
|
)
|