Fixed #28986 -- Prevented boolean values in admin list display from being formatted with thousand separators.

This commit is contained in:
Jonas Haag 2018-01-03 18:04:57 +01:00 committed by Tim Graham
parent ea10efebfa
commit 602481d0c9
2 changed files with 4 additions and 0 deletions

View File

@ -418,6 +418,8 @@ def display_for_value(value, empty_value_display, boolean=False):
return _boolean_icon(value) return _boolean_icon(value)
elif value is None: elif value is None:
return empty_value_display return empty_value_display
elif isinstance(value, bool):
return str(value)
elif isinstance(value, datetime.datetime): elif isinstance(value, datetime.datetime):
return formats.localize(timezone.template_localtime(value)) return formats.localize(timezone.template_localtime(value))
elif isinstance(value, (datetime.date, datetime.time)): elif isinstance(value, (datetime.date, datetime.time)):

View File

@ -210,6 +210,8 @@ class UtilsTests(SimpleTestCase):
display_for_value(False, '', boolean=True), display_for_value(False, '', boolean=True),
'<img src="/static/admin/img/icon-no.svg" alt="False" />' '<img src="/static/admin/img/icon-no.svg" alt="False" />'
) )
self.assertEqual(display_for_value(True, ''), 'True')
self.assertEqual(display_for_value(False, ''), 'False')
def test_label_for_field(self): def test_label_for_field(self):
""" """