mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Replace 'nullable' attribute with null_option
This commit is contained in:
@ -1747,12 +1747,10 @@ class DeviceForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
cluster_group = DynamicModelChoiceField(
|
||||
queryset=ClusterGroup.objects.all(),
|
||||
required=False,
|
||||
null_option='None',
|
||||
widget=APISelect(
|
||||
filter_for={
|
||||
'cluster': 'group_id'
|
||||
},
|
||||
attrs={
|
||||
'nullable': 'true'
|
||||
}
|
||||
)
|
||||
)
|
||||
@ -3438,12 +3436,10 @@ class ConnectCableToDeviceForm(BootstrapMixin, forms.ModelForm):
|
||||
queryset=Rack.objects.all(),
|
||||
label='Rack',
|
||||
required=False,
|
||||
null_option='None',
|
||||
widget=APISelect(
|
||||
filter_for={
|
||||
'termination_b_device': 'rack_id',
|
||||
},
|
||||
attrs={
|
||||
'nullable': 'true',
|
||||
}
|
||||
)
|
||||
)
|
||||
@ -3982,12 +3978,10 @@ class VirtualChassisCreateForm(BootstrapMixin, forms.ModelForm):
|
||||
rack = DynamicModelChoiceField(
|
||||
queryset=Rack.objects.all(),
|
||||
required=False,
|
||||
null_option='None',
|
||||
widget=APISelect(
|
||||
filter_for={
|
||||
'members': 'rack_id'
|
||||
},
|
||||
attrs={
|
||||
'nullable': 'true',
|
||||
}
|
||||
)
|
||||
)
|
||||
@ -4118,12 +4112,10 @@ class VCMemberSelectForm(BootstrapMixin, forms.Form):
|
||||
rack = DynamicModelChoiceField(
|
||||
queryset=Rack.objects.all(),
|
||||
required=False,
|
||||
null_option='None',
|
||||
widget=APISelect(
|
||||
filter_for={
|
||||
'device': 'rack_id'
|
||||
},
|
||||
attrs={
|
||||
'nullable': 'true',
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -257,13 +257,11 @@ class PrefixForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
site = DynamicModelChoiceField(
|
||||
queryset=Site.objects.all(),
|
||||
required=False,
|
||||
null_option='None',
|
||||
widget=APISelect(
|
||||
filter_for={
|
||||
'vlan_group': 'site_id',
|
||||
'vlan': 'site_id',
|
||||
},
|
||||
attrs={
|
||||
'nullable': 'true',
|
||||
}
|
||||
)
|
||||
)
|
||||
@ -271,12 +269,10 @@ class PrefixForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
queryset=VLANGroup.objects.all(),
|
||||
required=False,
|
||||
label='VLAN group',
|
||||
null_option='None',
|
||||
widget=APISelect(
|
||||
filter_for={
|
||||
'vlan': 'group_id'
|
||||
},
|
||||
attrs={
|
||||
'nullable': 'true',
|
||||
}
|
||||
)
|
||||
)
|
||||
@ -556,12 +552,10 @@ class IPAddressForm(BootstrapMixin, TenancyForm, ReturnURLForm, CustomFieldModel
|
||||
required=False,
|
||||
label='Rack',
|
||||
display_field='display_name',
|
||||
null_option='None',
|
||||
widget=APISelect(
|
||||
filter_for={
|
||||
'nat_device': 'rack_id'
|
||||
},
|
||||
attrs={
|
||||
'nullable': 'true'
|
||||
}
|
||||
)
|
||||
)
|
||||
@ -985,12 +979,10 @@ class VLANForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
site = DynamicModelChoiceField(
|
||||
queryset=Site.objects.all(),
|
||||
required=False,
|
||||
null_option='None',
|
||||
widget=APISelect(
|
||||
filter_for={
|
||||
'group': 'site_id'
|
||||
},
|
||||
attrs={
|
||||
'nullable': 'true',
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -74,7 +74,7 @@ $(document).ready(function() {
|
||||
form.submit();
|
||||
});
|
||||
|
||||
// Parse URLs which may contain variable refrences to other field values
|
||||
// Parse URLs which may contain variable references to other field values
|
||||
function parseURL(url) {
|
||||
var filter_regex = /\{\{([a-z_]+)\}\}/g;
|
||||
var match;
|
||||
@ -87,7 +87,7 @@ $(document).ready(function() {
|
||||
rendered_url = rendered_url.replace(match[0], custom_attr);
|
||||
} else if (filter_field.val()) {
|
||||
rendered_url = rendered_url.replace(match[0], filter_field.val());
|
||||
} else if (filter_field.attr('nullable') == 'true') {
|
||||
} else if (filter_field.attr('data-null-option')) {
|
||||
rendered_url = rendered_url.replace(match[0], 'null');
|
||||
}
|
||||
}
|
||||
@ -123,7 +123,7 @@ $(document).ready(function() {
|
||||
|
||||
// API backed selection
|
||||
// Includes live search and chained fields
|
||||
// The `multiple` setting may be controled via a data-* attribute
|
||||
// The `multiple` setting may be controlled via a data-* attribute
|
||||
$('.netbox-select2-api').select2({
|
||||
allowClear: true,
|
||||
placeholder: "---------",
|
||||
@ -165,7 +165,7 @@ $(document).ready(function() {
|
||||
filter_for_elements.each(function(index, filter_for_element) {
|
||||
var param_name = $(filter_for_element).attr(attr_name);
|
||||
var is_required = $(filter_for_element).attr("required");
|
||||
var is_nullable = $(filter_for_element).attr("nullable");
|
||||
var is_nullable = $(filter_for_element).attr("data-null-option");
|
||||
var is_visible = $(filter_for_element).is(":visible");
|
||||
var value = $(filter_for_element).val();
|
||||
|
||||
|
@ -119,12 +119,10 @@ class TenancyForm(forms.Form):
|
||||
tenant_group = DynamicModelChoiceField(
|
||||
queryset=TenantGroup.objects.all(),
|
||||
required=False,
|
||||
null_option='None',
|
||||
widget=APISelect(
|
||||
filter_for={
|
||||
'tenant': 'group_id',
|
||||
},
|
||||
attrs={
|
||||
'nullable': 'true',
|
||||
}
|
||||
)
|
||||
)
|
||||
|
@ -197,12 +197,10 @@ class ClusterAddDevicesForm(BootstrapMixin, forms.Form):
|
||||
region = DynamicModelChoiceField(
|
||||
queryset=Region.objects.all(),
|
||||
required=False,
|
||||
null_option='None',
|
||||
widget=APISelect(
|
||||
filter_for={
|
||||
"site": "region_id",
|
||||
},
|
||||
attrs={
|
||||
'nullable': 'true',
|
||||
}
|
||||
)
|
||||
)
|
||||
@ -219,12 +217,10 @@ class ClusterAddDevicesForm(BootstrapMixin, forms.Form):
|
||||
rack = DynamicModelChoiceField(
|
||||
queryset=Rack.objects.all(),
|
||||
required=False,
|
||||
null_option='None',
|
||||
widget=APISelect(
|
||||
filter_for={
|
||||
"devices": "rack_id"
|
||||
},
|
||||
attrs={
|
||||
'nullable': 'true',
|
||||
}
|
||||
)
|
||||
)
|
||||
@ -278,12 +274,10 @@ class VirtualMachineForm(BootstrapMixin, TenancyForm, CustomFieldModelForm):
|
||||
cluster_group = DynamicModelChoiceField(
|
||||
queryset=ClusterGroup.objects.all(),
|
||||
required=False,
|
||||
null_option='None',
|
||||
widget=APISelect(
|
||||
filter_for={
|
||||
"cluster": "group_id",
|
||||
},
|
||||
attrs={
|
||||
'nullable': 'true',
|
||||
}
|
||||
)
|
||||
)
|
||||
|
Reference in New Issue
Block a user