1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #978: Allow filtering device types by function and subdevice role

This commit is contained in:
Jeremy Stretch
2017-03-22 17:29:47 -04:00
parent 66a6a8f33c
commit 32bf17c076
2 changed files with 28 additions and 2 deletions

View File

@@ -23,7 +23,7 @@ from .models import (
Interface, IFACE_FF_CHOICES, IFACE_FF_LAG, IFACE_ORDERING_CHOICES, InterfaceConnection, InterfaceTemplate,
Manufacturer, Module, Platform, PowerOutlet, PowerOutletTemplate, PowerPort, PowerPortTemplate, RACK_TYPE_CHOICES,
RACK_WIDTH_CHOICES, Rack, RackGroup, RackReservation, RackRole, Region, Site, STATUS_CHOICES, SUBDEVICE_ROLE_CHILD,
VIRTUAL_IFACE_TYPES
SUBDEVICE_ROLE_PARENT, VIRTUAL_IFACE_TYPES
)
@@ -375,6 +375,21 @@ class DeviceTypeFilterForm(BootstrapMixin, CustomFieldFilterForm):
queryset=Manufacturer.objects.annotate(filter_count=Count('device_types')),
to_field_name='slug'
)
is_console_server = forms.BooleanField(
required=False, label='Is a console server', widget=forms.CheckboxInput(attrs={'value': 'True'}))
is_pdu = forms.BooleanField(
required=False, label='Is a PDU', widget=forms.CheckboxInput(attrs={'value': 'True'})
)
is_network_device = forms.BooleanField(
required=False, label='Is a network device', widget=forms.CheckboxInput(attrs={'value': 'True'})
)
subdevice_role = forms.NullBooleanField(
required=False, label='Subdevice role', widget=forms.Select(choices=(
('', '---------'),
(SUBDEVICE_ROLE_PARENT, 'Parent'),
(SUBDEVICE_ROLE_CHILD, 'Child'),
))
)
#