Skip to content

Commit

Permalink
Don't add a placeholder option to multiselect widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremystretch committed Sep 12, 2017
1 parent d651deb commit 136d16b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 3 additions & 1 deletion netbox/project-static/js/forms.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,9 @@ $(document).ready(function() {

// Wipe out any existing options within the child field and create a default option
child_field.empty();
child_field.append($("<option></option>").attr("value", "").text("---------"));
if (!child_field.attr('multiple')) {
child_field.append($("<option></option>").attr("value", "").text("---------"));
}

if ($(this).val() || $(this).attr('nullable') == 'true') {
var api_url = child_field.attr('api-url') + '&limit=1000';
Expand Down
1 change: 0 additions & 1 deletion netbox/virtualization/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ class ClusterAddDevicesForm(BootstrapMixin, ChainedFieldsMixin, forms.Form):
('rack', 'rack'),
),
label='Device',
required=False,
widget=APISelectMultiple(
api_url='/api/dcim/devices/?site_id={{site}}&rack_id={{rack}}',
display_field='display_name',
Expand Down

0 comments on commit 136d16b

Please sign in to comment.