mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-23 17:08:41 -06:00
Enforce consistent ordering of value/label keys for ChoiceField
This commit is contained in:
parent
a46f68c6e4
commit
2bae50f501
@ -71,7 +71,11 @@ class ChoiceField(Field):
|
|||||||
def to_representation(self, obj):
|
def to_representation(self, obj):
|
||||||
if obj is '':
|
if obj is '':
|
||||||
return None
|
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):
|
def to_internal_value(self, data):
|
||||||
# Hotwiring boolean values
|
# Hotwiring boolean values
|
||||||
|
Loading…
Reference in New Issue
Block a user