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

Corrected the 'type' filter for device lists to use device_type_id

This commit is contained in:
Jeremy Stretch
2016-03-02 12:02:57 -05:00
parent dcf67435c4
commit a89f415ff8
2 changed files with 5 additions and 5 deletions

View File

@ -115,7 +115,7 @@ class DeviceFilter(django_filters.FilterSet):
to_field_name='slug',
label='Role (slug)',
)
device_type = django_filters.ModelMultipleChoiceFilter(
device_type_id = django_filters.ModelMultipleChoiceFilter(
name='device_type',
queryset=DeviceType.objects.all(),
label='Device type (ID)',
@ -163,7 +163,7 @@ class DeviceFilter(django_filters.FilterSet):
class Meta:
model = Device
fields = ['q', 'name', 'site_id', 'site', 'rack_id', 'role_id', 'role', 'device_type', 'manufacturer_id',
fields = ['q', 'name', 'site_id', 'site', 'rack_id', 'role_id', 'role', 'device_type_id', 'manufacturer_id',
'manufacturer', 'model', 'platform_id', 'platform', 'is_console_server', 'is_pdu',
'is_network_device']

View File

@ -337,7 +337,7 @@ def device_role_choices():
def device_type_choices():
type_choices = DeviceType.objects.select_related('manufacturer').annotate(device_count=Count('instances'))
return [(t.slug, '{} ({})'.format(t, t.device_count)) for t in type_choices]
return [(t.pk, '{} ({})'.format(t, t.device_count)) for t in type_choices]
def device_platform_choices():
@ -350,8 +350,8 @@ class DeviceFilterForm(forms.Form, BootstrapMixin):
widget=forms.SelectMultiple(attrs={'size': 8}))
role = forms.MultipleChoiceField(required=False, choices=device_role_choices,
widget=forms.SelectMultiple(attrs={'size': 8}))
type = forms.MultipleChoiceField(required=False, choices=device_type_choices,
widget=forms.SelectMultiple(attrs={'size': 8}))
device_type_id = forms.MultipleChoiceField(required=False, choices=device_type_choices, label='Type',
widget=forms.SelectMultiple(attrs={'size': 8}))
platform = forms.MultipleChoiceField(required=False, choices=device_platform_choices)