mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-24 08:25:17 -06:00
Fixes: #13681 - Resolve TypeError when default is set on a "non required" custom field
This commit is contained in:
parent
6db6616892
commit
da4dc17abe
@ -40,11 +40,12 @@ class DynamicMultipleChoiceField(forms.MultipleChoiceField):
|
|||||||
def get_bound_field(self, form, field_name):
|
def get_bound_field(self, form, field_name):
|
||||||
bound_field = BoundField(form, self, field_name)
|
bound_field = BoundField(form, self, field_name)
|
||||||
data = bound_field.value()
|
data = bound_field.value()
|
||||||
|
|
||||||
if data is not None:
|
if data is not None:
|
||||||
self.choices = [
|
self.choices = [
|
||||||
choice for choice in self.choices if choice[0] in data
|
choice for choice in self.choices if choice[0] and choice[0] in data
|
||||||
]
|
]
|
||||||
|
else:
|
||||||
|
self.choices = []
|
||||||
|
|
||||||
return bound_field
|
return bound_field
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user