mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Closes #2512: Add device field to inventory item filter form
This commit is contained in:
@ -707,6 +707,15 @@ class InventoryItemFilter(DeviceComponentFilterSet):
|
||||
method='search',
|
||||
label='Search',
|
||||
)
|
||||
device_id = django_filters.ModelChoiceFilter(
|
||||
queryset=Device.objects.all(),
|
||||
label='Device (ID)',
|
||||
)
|
||||
device = django_filters.ModelChoiceFilter(
|
||||
queryset=Device.objects.all(),
|
||||
to_field_name='name',
|
||||
label='Device (name)',
|
||||
)
|
||||
parent_id = django_filters.ModelMultipleChoiceFilter(
|
||||
queryset=InventoryItem.objects.all(),
|
||||
label='Parent inventory item (ID)',
|
||||
|
@ -2201,6 +2201,7 @@ class InventoryItemBulkEditForm(BootstrapMixin, BulkEditForm):
|
||||
class InventoryItemFilterForm(BootstrapMixin, forms.Form):
|
||||
model = InventoryItem
|
||||
q = forms.CharField(required=False, label='Search')
|
||||
device = forms.CharField(required=False, label='Device name')
|
||||
manufacturer = FilterChoiceField(
|
||||
queryset=Manufacturer.objects.annotate(filter_count=Count('inventory_items')),
|
||||
to_field_name='slug',
|
||||
|
Reference in New Issue
Block a user