mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-15 18:52:27 +03:00
fix: MultipleChoiceField use ordered sort
This commit is contained in:
parent
3038494705
commit
8436483e66
|
@ -1469,17 +1469,17 @@ class MultipleChoiceField(ChoiceField):
|
|||
if not self.allow_empty and len(data) == 0:
|
||||
self.fail('empty')
|
||||
|
||||
return {
|
||||
# Arguments for super() are needed because of scoping inside
|
||||
# comprehensions.
|
||||
return list(dict.fromkeys([
|
||||
super(MultipleChoiceField, self).to_internal_value(item)
|
||||
for item in data
|
||||
}
|
||||
]))
|
||||
|
||||
def to_representation(self, value):
|
||||
return {
|
||||
return list(dict.fromkeys([
|
||||
self.choice_strings_to_values.get(str(item), item) for item in value
|
||||
}
|
||||
]))
|
||||
|
||||
|
||||
class FilePathField(ChoiceField):
|
||||
|
|
Loading…
Reference in New Issue
Block a user