mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-28 03:16:25 -06:00
Fixes #2319: Extend ChoiceField to properly handle true/false choice keys
This commit is contained in:
parent
e0b2367b47
commit
b3cff42105
@ -74,6 +74,12 @@ class ChoiceField(Field):
|
|||||||
return {'value': obj, 'label': self._choices[obj]}
|
return {'value': obj, 'label': self._choices[obj]}
|
||||||
|
|
||||||
def to_internal_value(self, data):
|
def to_internal_value(self, data):
|
||||||
|
# Hotwiring boolean values
|
||||||
|
if hasattr(data, 'lower'):
|
||||||
|
if data.lower() == 'true':
|
||||||
|
return True
|
||||||
|
if data.lower() == 'false':
|
||||||
|
return False
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user