diff --git a/netbox/circuits/filtersets.py b/netbox/circuits/filtersets.py index e28238fea..9d0b3f647 100644 --- a/netbox/circuits/filtersets.py +++ b/netbox/circuits/filtersets.py @@ -67,13 +67,14 @@ class ProviderFilterSet(NetBoxModelFilterSet, ContactModelFilterSet): class Meta: model = Provider - fields = ['id', 'name', 'slug'] + fields = ['id', 'name', 'slug', 'description'] def search(self, queryset, name, value): if not value.strip(): return queryset return queryset.filter( Q(name__icontains=value) | + Q(description__icontains=value) | Q(accounts__account__icontains=value) | Q(accounts__name__icontains=value) | Q(comments__icontains=value) @@ -101,6 +102,7 @@ class ProviderAccountFilterSet(NetBoxModelFilterSet): return queryset return queryset.filter( Q(name__icontains=value) | + Q(description__icontains=value) | Q(account__icontains=value) | Q(comments__icontains=value) ).distinct() diff --git a/netbox/core/filtersets.py b/netbox/core/filtersets.py index 62a58086a..25dea9c2c 100644 --- a/netbox/core/filtersets.py +++ b/netbox/core/filtersets.py @@ -26,7 +26,7 @@ class DataSourceFilterSet(NetBoxModelFilterSet): class Meta: model = DataSource - fields = ('id', 'name', 'enabled') + fields = ('id', 'name', 'enabled', 'description') def search(self, queryset, name, value): if not value.strip(): diff --git a/netbox/dcim/filtersets.py b/netbox/dcim/filtersets.py index 1e837ce0a..07692719f 100644 --- a/netbox/dcim/filtersets.py +++ b/netbox/dcim/filtersets.py @@ -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) ) diff --git a/netbox/extras/filtersets.py b/netbox/extras/filtersets.py index b33e70488..0b9e5309b 100644 --- a/netbox/extras/filtersets.py +++ b/netbox/extras/filtersets.py @@ -512,7 +512,7 @@ class ConfigContextFilterSet(ChangeLoggedModelFilterSet): class Meta: model = ConfigContext - fields = ['id', 'name', 'is_active', 'data_synced'] + fields = ['id', 'name', 'is_active', 'data_synced', 'description'] def search(self, queryset, name, value): if not value.strip(): diff --git a/netbox/ipam/filtersets.py b/netbox/ipam/filtersets.py index 8a65defff..2628ec2af 100644 --- a/netbox/ipam/filtersets.py +++ b/netbox/ipam/filtersets.py @@ -759,7 +759,7 @@ class FHRPGroupFilterSet(NetBoxModelFilterSet): class Meta: model = FHRPGroup - fields = ['id', 'group_id', 'name', 'auth_key'] + fields = ['id', 'group_id', 'name', 'auth_key', 'description'] def search(self, queryset, name, value): if not value.strip(): @@ -1009,12 +1009,15 @@ class ServiceTemplateFilterSet(NetBoxModelFilterSet): class Meta: model = ServiceTemplate - fields = ['id', 'name', 'protocol'] + fields = ['id', 'name', 'protocol', 'description'] def search(self, queryset, name, value): if not value.strip(): return queryset - qs_filter = Q(name__icontains=value) | Q(description__icontains=value) + qs_filter = ( + Q(name__icontains=value) | + Q(description__icontains=value) + ) return queryset.filter(qs_filter) diff --git a/netbox/netbox/filtersets.py b/netbox/netbox/filtersets.py index 49596dc98..ebb98d15f 100644 --- a/netbox/netbox/filtersets.py +++ b/netbox/netbox/filtersets.py @@ -315,5 +315,6 @@ class OrganizationalModelFilterSet(NetBoxModelFilterSet): return queryset return queryset.filter( models.Q(name__icontains=value) | - models.Q(slug__icontains=value) + models.Q(slug__icontains=value) | + models.Q(description__icontains=value) ) diff --git a/netbox/tenancy/filtersets.py b/netbox/tenancy/filtersets.py index 8bc659a88..7c1d1c470 100644 --- a/netbox/tenancy/filtersets.py +++ b/netbox/tenancy/filtersets.py @@ -65,7 +65,7 @@ class ContactFilterSet(NetBoxModelFilterSet): class Meta: model = Contact - fields = ['id', 'name', 'title', 'phone', 'email', 'address', 'link'] + fields = ['id', 'name', 'title', 'phone', 'email', 'address', 'link', 'description'] def search(self, queryset, name, value): if not value.strip(): @@ -77,6 +77,7 @@ class ContactFilterSet(NetBoxModelFilterSet): Q(email__icontains=value) | Q(address__icontains=value) | Q(link__icontains=value) | + Q(description__icontains=value) | Q(comments__icontains=value) ) diff --git a/netbox/virtualization/filtersets.py b/netbox/virtualization/filtersets.py index b23808b31..ba13394fe 100644 --- a/netbox/virtualization/filtersets.py +++ b/netbox/virtualization/filtersets.py @@ -100,13 +100,14 @@ class ClusterFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilte class Meta: model = Cluster - fields = ['id', 'name'] + fields = ['id', 'name', 'description'] def search(self, queryset, name, value): if not value.strip(): return queryset return queryset.filter( Q(name__icontains=value) | + Q(description__icontains=value) | Q(comments__icontains=value) ) @@ -238,13 +239,14 @@ class VirtualMachineFilterSet( class Meta: model = VirtualMachine - fields = ['id', 'cluster', 'vcpus', 'memory', 'disk'] + fields = ['id', 'cluster', 'vcpus', 'memory', 'disk', 'description'] def search(self, queryset, name, value): if not value.strip(): return queryset return queryset.filter( Q(name__icontains=value) | + Q(description__icontains=value) | Q(comments__icontains=value) | Q(primary_ip4__address__startswith=value) | Q(primary_ip6__address__startswith=value)