mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-08 00:28:16 -06:00
Add site to filter
This commit is contained in:
parent
ca83c32441
commit
ae37155de5
@ -601,6 +601,16 @@ class InterfaceListFilter(django_filters.FilterSet):
|
|||||||
name='name',
|
name='name',
|
||||||
label='Device',
|
label='Device',
|
||||||
)
|
)
|
||||||
|
site_id = django_filters.ModelMultipleChoiceFilter(
|
||||||
|
queryset=Site.objects.all(),
|
||||||
|
label='Site (ID)',
|
||||||
|
)
|
||||||
|
site = django_filters.ModelMultipleChoiceFilter(
|
||||||
|
name='site__slug',
|
||||||
|
queryset=Site.objects.all(),
|
||||||
|
to_field_name='slug',
|
||||||
|
label='Site name (slug)',
|
||||||
|
)
|
||||||
type = django_filters.CharFilter(
|
type = django_filters.CharFilter(
|
||||||
method='filter_type',
|
method='filter_type',
|
||||||
label='Interface type',
|
label='Interface type',
|
||||||
|
@ -1621,7 +1621,7 @@ class InterfaceListFilterForm(BootstrapMixin, forms.Form):
|
|||||||
model = Interface
|
model = Interface
|
||||||
q = forms.CharField(required=False, label='Search')
|
q = forms.CharField(required=False, label='Search')
|
||||||
site = FilterChoiceField(
|
site = FilterChoiceField(
|
||||||
queryset=Site.objects.annotate(filter_count=Count('devices')),
|
queryset=Site.objects.annotate(filter_count=Count('interfaces')),
|
||||||
to_field_name='slug',
|
to_field_name='slug',
|
||||||
)
|
)
|
||||||
#device = forms.ModelChoiceField(required=False, queryset=Device.objects.all(), to_field_name='slug')
|
#device = forms.ModelChoiceField(required=False, queryset=Device.objects.all(), to_field_name='slug')
|
||||||
|
Loading…
Reference in New Issue
Block a user