From 602481d0c9edb79692955e073fa481c322f1df47 Mon Sep 17 00:00:00 2001 From: Jonas Haag Date: Wed, 3 Jan 2018 18:04:57 +0100 Subject: [PATCH] Fixed #28986 -- Prevented boolean values in admin list display from being formatted with thousand separators. --- django/contrib/admin/utils.py | 2 ++ tests/admin_utils/tests.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/django/contrib/admin/utils.py b/django/contrib/admin/utils.py index 849a695276b..a2518a78a1e 100644 --- a/django/contrib/admin/utils.py +++ b/django/contrib/admin/utils.py @@ -418,6 +418,8 @@ def display_for_value(value, empty_value_display, boolean=False): return _boolean_icon(value) elif value is None: return empty_value_display + elif isinstance(value, bool): + return str(value) elif isinstance(value, datetime.datetime): return formats.localize(timezone.template_localtime(value)) elif isinstance(value, (datetime.date, datetime.time)): diff --git a/tests/admin_utils/tests.py b/tests/admin_utils/tests.py index 212254f4fd0..aae8b74ae2b 100644 --- a/tests/admin_utils/tests.py +++ b/tests/admin_utils/tests.py @@ -210,6 +210,8 @@ class UtilsTests(SimpleTestCase): display_for_value(False, '', boolean=True), 'False' ) + self.assertEqual(display_for_value(True, ''), 'True') + self.assertEqual(display_for_value(False, ''), 'False') def test_label_for_field(self): """