Fixed #28986 -- Prevented boolean values in admin list display from being formatted with thousand separators.
This commit is contained in:
parent
ea10efebfa
commit
602481d0c9
|
@ -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)):
|
||||||
|
|
|
@ -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):
|
||||||
"""
|
"""
|
||||||
|
|
Loading…
Reference in New Issue