1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Fixes #2319: Extend ChoiceField to properly handle true/false choice keys

This commit is contained in:
Jeremy Stretch
2018-08-07 13:48:29 -04:00
parent f4485dc72a
commit c51c20a301

View File

@ -74,6 +74,12 @@ class ChoiceField(Field):
return {'value': obj, 'label': self._choices[obj]}
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