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:
@ -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
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user