mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #7087: Add search/filter forms for all organizational models
This commit is contained in:
@@ -61,6 +61,18 @@ class ClusterTypeBulkEditForm(BootstrapMixin, CustomFieldModelBulkEditForm):
|
||||
nullable_fields = ['description']
|
||||
|
||||
|
||||
class ClusterTypeFilterForm(BootstrapMixin, CustomFieldModelFilterForm):
|
||||
model = ClusterType
|
||||
field_groups = [
|
||||
['q'],
|
||||
]
|
||||
q = forms.CharField(
|
||||
required=False,
|
||||
widget=forms.TextInput(attrs={'placeholder': _('All Fields')}),
|
||||
label=_('Search')
|
||||
)
|
||||
|
||||
|
||||
#
|
||||
# Cluster groups
|
||||
#
|
||||
@@ -97,6 +109,18 @@ class ClusterGroupBulkEditForm(BootstrapMixin, CustomFieldModelBulkEditForm):
|
||||
nullable_fields = ['description']
|
||||
|
||||
|
||||
class ClusterGroupFilterForm(BootstrapMixin, CustomFieldModelFilterForm):
|
||||
model = ClusterGroup
|
||||
field_groups = [
|
||||
['q'],
|
||||
]
|
||||
q = forms.CharField(
|
||||
required=False,
|
||||
widget=forms.TextInput(attrs={'placeholder': _('All Fields')}),
|
||||
label=_('Search')
|
||||
)
|
||||
|
||||
|
||||
#
|
||||
# Clusters
|
||||
#
|
||||
|
||||
@@ -24,6 +24,8 @@ class ClusterTypeListView(generic.ObjectListView):
|
||||
queryset = ClusterType.objects.annotate(
|
||||
cluster_count=count_related(Cluster, 'type')
|
||||
)
|
||||
filterset = filtersets.ClusterTypeFilterSet
|
||||
filterset_form = forms.ClusterTypeFilterForm
|
||||
table = tables.ClusterTypeTable
|
||||
|
||||
|
||||
@@ -86,6 +88,8 @@ class ClusterGroupListView(generic.ObjectListView):
|
||||
queryset = ClusterGroup.objects.annotate(
|
||||
cluster_count=count_related(Cluster, 'group')
|
||||
)
|
||||
filterset = filtersets.ClusterGroupFilterSet
|
||||
filterset_form = forms.ClusterGroupFilterForm
|
||||
table = tables.ClusterGroupTable
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user