mirror of
https://github.com/netbox-community/netbox.git
synced 2024-05-10 07:54:54 +00:00
Enforce consistent ordering of value/label keys for ChoiceField
This commit is contained in:
@ -71,7 +71,11 @@ class ChoiceField(Field):
|
||||
def to_representation(self, obj):
|
||||
if obj is '':
|
||||
return None
|
||||
return {'value': obj, 'label': self._choices[obj]}
|
||||
data = OrderedDict([
|
||||
('value', obj),
|
||||
('label', self._choices[obj])
|
||||
])
|
||||
return data
|
||||
|
||||
def to_internal_value(self, data):
|
||||
# Hotwiring boolean values
|
||||
|
Reference in New Issue
Block a user