mirror of
https://github.com/encode/django-rest-framework.git
synced 2025-07-29 17:39:48 +03:00
Fixing failing test with coercing strs to ints
This commit is contained in:
parent
00b7bb8110
commit
f4376fb683
|
@ -1468,7 +1468,7 @@ class ChoiceField(Field):
|
||||||
def to_representation(self, value):
|
def to_representation(self, value):
|
||||||
# Preserving old untyped behavior
|
# Preserving old untyped behavior
|
||||||
if not self.underlying_field:
|
if not self.underlying_field:
|
||||||
return value
|
return self.choice_reprs_to_values.get(str(value), value)
|
||||||
return self.underlying_field.to_representation(value)
|
return self.underlying_field.to_representation(value)
|
||||||
|
|
||||||
def iter_options(self):
|
def iter_options(self):
|
||||||
|
@ -1533,7 +1533,9 @@ class MultipleChoiceField(ChoiceField):
|
||||||
|
|
||||||
def to_representation(self, value):
|
def to_representation(self, value):
|
||||||
return {
|
return {
|
||||||
self.underlying_field.to_representation(item) if self.underlying_field else value for item in value
|
self.underlying_field.to_representation(item)
|
||||||
|
if self.underlying_field
|
||||||
|
else self.choice_reprs_to_values.get(str(item), item) for item in value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user