mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-17 04:32:51 -06:00
Fixes #2319: Extend ChoiceField to properly handle true/false choice keys
This commit is contained in:
parent
f4485dc72a
commit
c51c20a301
@ -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