Select2 widgets for type, status, and length unit of cable

This commit is contained in:
Saria Hajjar 2020-01-11 11:03:53 +00:00
parent d0ec51eff0
commit 7c4c908758
3 changed files with 14 additions and 4 deletions

View File

@ -2725,6 +2725,11 @@ class ConnectCableToDeviceForm(BootstrapMixin, ChainedFieldsMixin, forms.ModelFo
'termination_b_site', 'termination_b_rack', 'termination_b_device', 'termination_b_id', 'type', 'status',
'label', 'color', 'length', 'length_unit',
]
widgets = {
'type': StaticSelect2(),
'status': StaticSelect2(),
'length_unit': StaticSelect2(),
}
def __init__(self, *args, **kwargs):
@ -2929,6 +2934,11 @@ class CableForm(BootstrapMixin, forms.ModelForm):
fields = [
'type', 'status', 'label', 'color', 'length', 'length_unit',
]
widgets = {
'type': StaticSelect2(),
'status': StaticSelect2(),
'length_unit': StaticSelect2(),
}
class CableCSVForm(forms.ModelForm):

View File

@ -154,10 +154,10 @@
{% render_field form.color %}
<div class="form-group">
<label class="col-md-3 control-label" for="id_length">{{ form.length.label }}</label>
<div class="col-md-6">
<div class="col-md-5">
{{ form.length }}
</div>
<div class="col-md-3">
<div class="col-md-4">
{{ form.length_unit }}
</div>
</div>

View File

@ -11,10 +11,10 @@
{% render_field form.color %}
<div class="form-group">
<label class="col-md-3 control-label" for="id_length">{{ form.length.label }}</label>
<div class="col-md-6">
<div class="col-md-5">
{{ form.length }}
</div>
<div class="col-md-3">
<div class="col-md-4">
{{ form.length_unit }}
</div>
</div>