mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-16 12:38:17 -06:00
Add filter for has local context data
This commit is contained in:
parent
dfd4a712c9
commit
c274b4a729
@ -597,6 +597,10 @@ class DeviceFilter(CustomFieldFilterSet):
|
|||||||
method='_pass_through_ports',
|
method='_pass_through_ports',
|
||||||
label='Has 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()
|
tag = TagFilter()
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
@ -651,6 +655,9 @@ class DeviceFilter(CustomFieldFilterSet):
|
|||||||
def _interfaces(self, queryset, name, value):
|
def _interfaces(self, queryset, name, value):
|
||||||
return queryset.exclude(interfaces__isnull=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):
|
def _pass_through_ports(self, queryset, name, value):
|
||||||
return queryset.exclude(
|
return queryset.exclude(
|
||||||
frontports__isnull=value,
|
frontports__isnull=value,
|
||||||
|
@ -1800,6 +1800,13 @@ class DeviceFilterForm(BootstrapMixin, CustomFieldFilterForm):
|
|||||||
choices=BOOLEAN_WITH_BLANK_CHOICES
|
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
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
|
Loading…
Reference in New Issue
Block a user