mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 04:22:01 -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,
|
required=False,
|
||||||
widget=ColorSelect()
|
widget=ColorSelect()
|
||||||
)
|
)
|
||||||
device = forms.CharField(
|
device_id = FilterChoiceField(
|
||||||
|
queryset=Device.objects.all(),
|
||||||
required=False,
|
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):
|
class ConsoleConnectionFilterForm(BootstrapMixin, forms.Form):
|
||||||
site = forms.ModelChoiceField(
|
site = FilterChoiceField(
|
||||||
queryset=Site.objects.all(),
|
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,
|
required=False,
|
||||||
label='Device name'
|
label='Device',
|
||||||
|
widget=APISelect(
|
||||||
|
api_url='/api/dcim/devices/',
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class PowerConnectionFilterForm(BootstrapMixin, forms.Form):
|
class PowerConnectionFilterForm(BootstrapMixin, forms.Form):
|
||||||
site = forms.ModelChoiceField(
|
site = FilterChoiceField(
|
||||||
queryset=Site.objects.all(),
|
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,
|
required=False,
|
||||||
label='Device name'
|
label='Device',
|
||||||
|
widget=APISelect(
|
||||||
|
api_url='/api/dcim/devices/',
|
||||||
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
class InterfaceConnectionFilterForm(BootstrapMixin, forms.Form):
|
class InterfaceConnectionFilterForm(BootstrapMixin, forms.Form):
|
||||||
site = forms.ModelChoiceField(
|
site = FilterChoiceField(
|
||||||
queryset=Site.objects.all(),
|
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,
|
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,
|
required=False,
|
||||||
label='Search'
|
label='Search'
|
||||||
)
|
)
|
||||||
device = forms.CharField(
|
device_id = FilterChoiceField(
|
||||||
|
queryset=Device.objects.all(),
|
||||||
required=False,
|
required=False,
|
||||||
label='Device name'
|
label='Device',
|
||||||
|
widget=APISelect(
|
||||||
|
api_url='/api/dcim/devices/',
|
||||||
|
)
|
||||||
)
|
)
|
||||||
manufacturer = FilterChoiceField(
|
manufacturer = FilterChoiceField(
|
||||||
queryset=Manufacturer.objects.all(),
|
queryset=Manufacturer.objects.all(),
|
||||||
|
Loading…
Reference in New Issue
Block a user