Add filter for has local context data

This commit is contained in:
dansheps 2019-05-06 13:06:03 -05:00
parent dfd4a712c9
commit c274b4a729
2 changed files with 14 additions and 0 deletions

View File

@ -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,

View File

@ -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
)
)
#