1
0
mirror of https://github.com/django/django.git synced 2025-11-07 07:15:35 +00:00

Fixed #27866 -- Made ChoiceWidget.format_value() return a list

Thanks Tim Graham for the review.
This commit is contained in:
Claude Paroz
2017-02-21 13:27:29 +01:00
parent 6b3724fa11
commit e487ffd3f0
2 changed files with 8 additions and 8 deletions

View File

@@ -628,16 +628,10 @@ class ChoiceWidget(Widget):
return getter(name)
def format_value(self, value):
"""Return selected values as a set."""
"""Return selected values as a list."""
if not isinstance(value, (tuple, list)):
value = [value]
values = set()
for v in value:
if v is None:
values.add('')
else:
values.add(force_text(v))
return values
return [str(v) if v is not None else '' for v in value]
class Select(ChoiceWidget):