mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-26 18:38:38 -06:00
Fixes: #5315 - Make "null_option" on DynamicModelChoiceField also null the value on the model.
This commit is contained in:
parent
1964073072
commit
0f0010bac0
@ -1,5 +1,13 @@
|
|||||||
# NetBox v2.10
|
# NetBox v2.10
|
||||||
|
|
||||||
|
## v2.10.5 (FUTURE)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#5315](https://github.com/netbox-community/netbox/issues/5315) - Fix site unassignment from VLAN when using "None" option
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## v2.10.4 (2021-01-26)
|
## v2.10.4 (2021-01-26)
|
||||||
|
|
||||||
### Enhancements
|
### Enhancements
|
||||||
|
@ -355,7 +355,11 @@ class DynamicModelChoiceField(DynamicModelChoiceMixin, forms.ModelChoiceField):
|
|||||||
Override get_bound_field() to avoid pre-populating field choices with a SQL query. The field will be
|
Override get_bound_field() to avoid pre-populating field choices with a SQL query. The field will be
|
||||||
rendered only with choices set via bound data. Choices are populated on-demand via the APISelect widget.
|
rendered only with choices set via bound data. Choices are populated on-demand via the APISelect widget.
|
||||||
"""
|
"""
|
||||||
pass
|
|
||||||
|
def clean(self, value):
|
||||||
|
if self.null_option is not None and value == 'null':
|
||||||
|
return None
|
||||||
|
return super().clean(value)
|
||||||
|
|
||||||
|
|
||||||
class DynamicModelMultipleChoiceField(DynamicModelChoiceMixin, forms.ModelMultipleChoiceField):
|
class DynamicModelMultipleChoiceField(DynamicModelChoiceMixin, forms.ModelMultipleChoiceField):
|
||||||
|
Loading…
Reference in New Issue
Block a user