diff --git a/netbox/dcim/filters.py b/netbox/dcim/filters.py index 7c190176b..0db4e5b86 100644 --- a/netbox/dcim/filters.py +++ b/netbox/dcim/filters.py @@ -597,6 +597,10 @@ class DeviceFilter(CustomFieldFilterSet): method='_pass_through_ports', label='Has pass-through ports', ) + local_context_data = django_filters.BooleanFilter( + method='_local_context_data', + label='Has local config context data', + ) tag = TagFilter() class Meta: @@ -651,6 +655,9 @@ class DeviceFilter(CustomFieldFilterSet): def _interfaces(self, queryset, name, value): return queryset.exclude(interfaces__isnull=value) + def _local_context_data(self, queryset, name, value): + return queryset.exclude(local_context_data__isnull=value) + def _pass_through_ports(self, queryset, name, value): return queryset.exclude( frontports__isnull=value, diff --git a/netbox/dcim/forms.py b/netbox/dcim/forms.py index 71ad45409..c0492637d 100644 --- a/netbox/dcim/forms.py +++ b/netbox/dcim/forms.py @@ -1800,6 +1800,13 @@ class DeviceFilterForm(BootstrapMixin, CustomFieldFilterForm): choices=BOOLEAN_WITH_BLANK_CHOICES ) ) + local_context_data = forms.NullBooleanField( + required=False, + label='Has local config context data', + widget=StaticSelect2( + choices=BOOLEAN_WITH_BLANK_CHOICES + ) + ) #