mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-19 09:53:34 -06:00
Replace HiddenInput widget on device component creation forms with APISelect
This commit is contained in:
parent
c1c8b5e816
commit
71601aad39
@ -2181,8 +2181,10 @@ class ConsolePortForm(BootstrapMixin, forms.ModelForm):
|
|||||||
|
|
||||||
class ConsolePortCreateForm(ComponentForm):
|
class ConsolePortCreateForm(ComponentForm):
|
||||||
device = forms.ModelChoiceField(
|
device = forms.ModelChoiceField(
|
||||||
queryset=Device.objects.all(),
|
queryset=Device.objects.prefetch_related('device_type__manufacturer'),
|
||||||
widget=forms.HiddenInput()
|
widget=APISelect(
|
||||||
|
api_url="/api/dcim/devices/",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
name_pattern = ExpandableNameField(
|
name_pattern = ExpandableNameField(
|
||||||
label='Name'
|
label='Name'
|
||||||
@ -2243,8 +2245,10 @@ class ConsoleServerPortForm(BootstrapMixin, forms.ModelForm):
|
|||||||
|
|
||||||
class ConsoleServerPortCreateForm(ComponentForm):
|
class ConsoleServerPortCreateForm(ComponentForm):
|
||||||
device = forms.ModelChoiceField(
|
device = forms.ModelChoiceField(
|
||||||
queryset=Device.objects.all(),
|
queryset=Device.objects.prefetch_related('device_type__manufacturer'),
|
||||||
widget=forms.HiddenInput()
|
widget=APISelect(
|
||||||
|
api_url="/api/dcim/devices/",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
name_pattern = ExpandableNameField(
|
name_pattern = ExpandableNameField(
|
||||||
label='Name'
|
label='Name'
|
||||||
@ -2340,8 +2344,10 @@ class PowerPortForm(BootstrapMixin, forms.ModelForm):
|
|||||||
|
|
||||||
class PowerPortCreateForm(ComponentForm):
|
class PowerPortCreateForm(ComponentForm):
|
||||||
device = forms.ModelChoiceField(
|
device = forms.ModelChoiceField(
|
||||||
queryset=Device.objects.all(),
|
queryset=Device.objects.prefetch_related('device_type__manufacturer'),
|
||||||
widget=forms.HiddenInput()
|
widget=APISelect(
|
||||||
|
api_url="/api/dcim/devices/",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
name_pattern = ExpandableNameField(
|
name_pattern = ExpandableNameField(
|
||||||
label='Name'
|
label='Name'
|
||||||
@ -2425,8 +2431,10 @@ class PowerOutletForm(BootstrapMixin, forms.ModelForm):
|
|||||||
|
|
||||||
class PowerOutletCreateForm(ComponentForm):
|
class PowerOutletCreateForm(ComponentForm):
|
||||||
device = forms.ModelChoiceField(
|
device = forms.ModelChoiceField(
|
||||||
queryset=Device.objects.all(),
|
queryset=Device.objects.prefetch_related('device_type__manufacturer'),
|
||||||
widget=forms.HiddenInput()
|
widget=APISelect(
|
||||||
|
api_url="/api/dcim/devices/",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
name_pattern = ExpandableNameField(
|
name_pattern = ExpandableNameField(
|
||||||
label='Name'
|
label='Name'
|
||||||
@ -2638,8 +2646,10 @@ class InterfaceForm(InterfaceCommonForm, BootstrapMixin, forms.ModelForm):
|
|||||||
|
|
||||||
class InterfaceCreateForm(InterfaceCommonForm, ComponentForm, forms.Form):
|
class InterfaceCreateForm(InterfaceCommonForm, ComponentForm, forms.Form):
|
||||||
device = forms.ModelChoiceField(
|
device = forms.ModelChoiceField(
|
||||||
queryset=Device.objects.all(),
|
queryset=Device.objects.prefetch_related('device_type__manufacturer'),
|
||||||
widget=forms.HiddenInput()
|
widget=APISelect(
|
||||||
|
api_url="/api/dcim/devices/",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
name_pattern = ExpandableNameField(
|
name_pattern = ExpandableNameField(
|
||||||
label='Name'
|
label='Name'
|
||||||
@ -2932,8 +2942,10 @@ class FrontPortForm(BootstrapMixin, forms.ModelForm):
|
|||||||
# TODO: Merge with FrontPortTemplateCreateForm to remove duplicate logic
|
# TODO: Merge with FrontPortTemplateCreateForm to remove duplicate logic
|
||||||
class FrontPortCreateForm(ComponentForm):
|
class FrontPortCreateForm(ComponentForm):
|
||||||
device = forms.ModelChoiceField(
|
device = forms.ModelChoiceField(
|
||||||
queryset=Device.objects.all(),
|
queryset=Device.objects.prefetch_related('device_type__manufacturer'),
|
||||||
widget=forms.HiddenInput()
|
widget=APISelect(
|
||||||
|
api_url="/api/dcim/devices/",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
name_pattern = ExpandableNameField(
|
name_pattern = ExpandableNameField(
|
||||||
label='Name'
|
label='Name'
|
||||||
@ -3108,8 +3120,10 @@ class RearPortForm(BootstrapMixin, forms.ModelForm):
|
|||||||
|
|
||||||
class RearPortCreateForm(ComponentForm):
|
class RearPortCreateForm(ComponentForm):
|
||||||
device = forms.ModelChoiceField(
|
device = forms.ModelChoiceField(
|
||||||
queryset=Device.objects.all(),
|
queryset=Device.objects.prefetch_related('device_type__manufacturer'),
|
||||||
widget=forms.HiddenInput()
|
widget=APISelect(
|
||||||
|
api_url="/api/dcim/devices/",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
name_pattern = ExpandableNameField(
|
name_pattern = ExpandableNameField(
|
||||||
label='Name'
|
label='Name'
|
||||||
@ -3716,8 +3730,10 @@ class DeviceBayForm(BootstrapMixin, forms.ModelForm):
|
|||||||
|
|
||||||
class DeviceBayCreateForm(ComponentForm):
|
class DeviceBayCreateForm(ComponentForm):
|
||||||
device = forms.ModelChoiceField(
|
device = forms.ModelChoiceField(
|
||||||
queryset=Device.objects.all(),
|
queryset=Device.objects.prefetch_related('device_type__manufacturer'),
|
||||||
widget=forms.HiddenInput()
|
widget=APISelect(
|
||||||
|
api_url="/api/dcim/devices/",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
name_pattern = ExpandableNameField(
|
name_pattern = ExpandableNameField(
|
||||||
label='Name'
|
label='Name'
|
||||||
@ -3892,8 +3908,10 @@ class InventoryItemForm(BootstrapMixin, forms.ModelForm):
|
|||||||
|
|
||||||
class InventoryItemCreateForm(ComponentForm):
|
class InventoryItemCreateForm(ComponentForm):
|
||||||
device = forms.ModelChoiceField(
|
device = forms.ModelChoiceField(
|
||||||
queryset=Device.objects.all(),
|
queryset=Device.objects.prefetch_related('device_type__manufacturer'),
|
||||||
widget=forms.HiddenInput()
|
widget=APISelect(
|
||||||
|
api_url="/api/dcim/devices/",
|
||||||
|
)
|
||||||
)
|
)
|
||||||
name_pattern = ExpandableNameField(
|
name_pattern = ExpandableNameField(
|
||||||
label='Name'
|
label='Name'
|
||||||
|
@ -21,12 +21,6 @@
|
|||||||
<strong>{{ component_type|title }}</strong>
|
<strong>{{ component_type|title }}</strong>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<div class="form-group">
|
|
||||||
<label class="col-md-3 control-label required">Device</label>
|
|
||||||
<div class="col-md-9">
|
|
||||||
<p class="form-control-static">{{ form.device.value }}</p>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% render_form form %}
|
{% render_form form %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
Reference in New Issue
Block a user