mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-25 01:48:38 -06:00
Add manufacturer filter for Rack; extend RackFilterForm
This commit is contained in:
parent
047d717532
commit
da7d47d3ed
@ -375,6 +375,17 @@ class RackFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilterSe
|
|||||||
to_field_name='slug',
|
to_field_name='slug',
|
||||||
label=_('Location (slug)'),
|
label=_('Location (slug)'),
|
||||||
)
|
)
|
||||||
|
manufacturer_id = django_filters.ModelMultipleChoiceFilter(
|
||||||
|
field_name='rack_type__manufacturer',
|
||||||
|
queryset=Manufacturer.objects.all(),
|
||||||
|
label=_('Manufacturer (ID)'),
|
||||||
|
)
|
||||||
|
manufacturer = django_filters.ModelMultipleChoiceFilter(
|
||||||
|
field_name='rack_type__manufacturer__slug',
|
||||||
|
queryset=Manufacturer.objects.all(),
|
||||||
|
to_field_name='slug',
|
||||||
|
label=_('Manufacturer (slug)'),
|
||||||
|
)
|
||||||
rack_type = django_filters.ModelMultipleChoiceFilter(
|
rack_type = django_filters.ModelMultipleChoiceFilter(
|
||||||
field_name='rack_type__slug',
|
field_name='rack_type__slug',
|
||||||
queryset=RackType.objects.all(),
|
queryset=RackType.objects.all(),
|
||||||
|
@ -312,8 +312,8 @@ class RackFilterForm(TenancyFilterForm, ContactModelFilterForm, RackBaseFilterFo
|
|||||||
FieldSet('q', 'filter_id', 'tag'),
|
FieldSet('q', 'filter_id', 'tag'),
|
||||||
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', name=_('Location')),
|
FieldSet('region_id', 'site_group_id', 'site_id', 'location_id', name=_('Location')),
|
||||||
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
FieldSet('tenant_group_id', 'tenant_id', name=_('Tenant')),
|
||||||
FieldSet('status', 'role_id', 'serial', 'asset_tag', name=_('Rack')),
|
FieldSet('status', 'role_id', 'manufacturer_id', 'rack_type_id', 'serial', 'asset_tag', name=_('Rack')),
|
||||||
FieldSet('form_factor', 'width', 'u_height', 'airflow', name=_('Rack Type')),
|
FieldSet('form_factor', 'width', 'u_height', 'airflow', name=_('Hardware')),
|
||||||
FieldSet('starting_unit', 'desc_units', name=_('Numbering')),
|
FieldSet('starting_unit', 'desc_units', name=_('Numbering')),
|
||||||
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
|
FieldSet('weight', 'max_weight', 'weight_unit', name=_('Weight')),
|
||||||
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')),
|
FieldSet('contact', 'contact_role', 'contact_group', name=_('Contacts')),
|
||||||
@ -357,6 +357,19 @@ class RackFilterForm(TenancyFilterForm, ContactModelFilterForm, RackBaseFilterFo
|
|||||||
null_option='None',
|
null_option='None',
|
||||||
label=_('Role')
|
label=_('Role')
|
||||||
)
|
)
|
||||||
|
manufacturer_id = DynamicModelMultipleChoiceField(
|
||||||
|
queryset=Manufacturer.objects.all(),
|
||||||
|
required=False,
|
||||||
|
label=_('Manufacturer')
|
||||||
|
)
|
||||||
|
rack_type_id = DynamicModelMultipleChoiceField(
|
||||||
|
queryset=RackType.objects.all(),
|
||||||
|
required=False,
|
||||||
|
query_params={
|
||||||
|
'manufacturer_id': '$manufacturer_id'
|
||||||
|
},
|
||||||
|
label=_('Rack type')
|
||||||
|
)
|
||||||
serial = forms.CharField(
|
serial = forms.CharField(
|
||||||
label=_('Serial'),
|
label=_('Serial'),
|
||||||
required=False
|
required=False
|
||||||
|
Loading…
Reference in New Issue
Block a user