mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-22 20:12:00 -06:00
Merge pull request #3826 from hSaria/3122-connection-device-select2
Fixes #3122: Select2 for device field
This commit is contained in:
commit
caa062c8ba
@ -3171,9 +3171,13 @@ class CableFilterForm(BootstrapMixin, forms.Form):
|
||||
required=False,
|
||||
widget=ColorSelect()
|
||||
)
|
||||
device = forms.CharField(
|
||||
device_id = FilterChoiceField(
|
||||
queryset=Device.objects.all(),
|
||||
required=False,
|
||||
label='Device name'
|
||||
label='Device',
|
||||
widget=APISelect(
|
||||
api_url='/api/dcim/devices/',
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@ -3238,38 +3242,59 @@ class DeviceBayBulkRenameForm(BulkRenameForm):
|
||||
#
|
||||
|
||||
class ConsoleConnectionFilterForm(BootstrapMixin, forms.Form):
|
||||
site = forms.ModelChoiceField(
|
||||
site = FilterChoiceField(
|
||||
queryset=Site.objects.all(),
|
||||
required=False,
|
||||
to_field_name='slug'
|
||||
to_field_name='slug',
|
||||
widget=APISelectMultiple(
|
||||
api_url="/api/dcim/sites/",
|
||||
value_field="slug",
|
||||
)
|
||||
)
|
||||
device = forms.CharField(
|
||||
device_id = FilterChoiceField(
|
||||
queryset=Device.objects.all(),
|
||||
required=False,
|
||||
label='Device name'
|
||||
label='Device',
|
||||
widget=APISelect(
|
||||
api_url='/api/dcim/devices/',
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class PowerConnectionFilterForm(BootstrapMixin, forms.Form):
|
||||
site = forms.ModelChoiceField(
|
||||
site = FilterChoiceField(
|
||||
queryset=Site.objects.all(),
|
||||
required=False,
|
||||
to_field_name='slug'
|
||||
to_field_name='slug',
|
||||
widget=APISelectMultiple(
|
||||
api_url="/api/dcim/sites/",
|
||||
value_field="slug",
|
||||
)
|
||||
)
|
||||
device = forms.CharField(
|
||||
device_id = FilterChoiceField(
|
||||
queryset=Device.objects.all(),
|
||||
required=False,
|
||||
label='Device name'
|
||||
label='Device',
|
||||
widget=APISelect(
|
||||
api_url='/api/dcim/devices/',
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class InterfaceConnectionFilterForm(BootstrapMixin, forms.Form):
|
||||
site = forms.ModelChoiceField(
|
||||
site = FilterChoiceField(
|
||||
queryset=Site.objects.all(),
|
||||
required=False,
|
||||
to_field_name='slug'
|
||||
to_field_name='slug',
|
||||
widget=APISelectMultiple(
|
||||
api_url="/api/dcim/sites/",
|
||||
value_field="slug",
|
||||
)
|
||||
)
|
||||
device = forms.CharField(
|
||||
device_id = FilterChoiceField(
|
||||
queryset=Device.objects.all(),
|
||||
required=False,
|
||||
label='Device name'
|
||||
label='Device',
|
||||
widget=APISelect(
|
||||
api_url='/api/dcim/devices/',
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@ -3362,9 +3387,13 @@ class InventoryItemFilterForm(BootstrapMixin, forms.Form):
|
||||
required=False,
|
||||
label='Search'
|
||||
)
|
||||
device = forms.CharField(
|
||||
device_id = FilterChoiceField(
|
||||
queryset=Device.objects.all(),
|
||||
required=False,
|
||||
label='Device name'
|
||||
label='Device',
|
||||
widget=APISelect(
|
||||
api_url='/api/dcim/devices/',
|
||||
)
|
||||
)
|
||||
manufacturer = FilterChoiceField(
|
||||
queryset=Manufacturer.objects.all(),
|
||||
|
Loading…
Reference in New Issue
Block a user