From 2b96c3e364b88dfd2db460cc2faf960bb767d01d Mon Sep 17 00:00:00 2001 From: Matt Westcott <matt@west.co.tt> Date: Tue, 27 Aug 2024 14:10:43 +0100 Subject: [PATCH] Add clarifying comment to Column --- wagtail/admin/ui/tables/__init__.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wagtail/admin/ui/tables/__init__.py b/wagtail/admin/ui/tables/__init__.py index cbb8499811..1de398b254 100644 --- a/wagtail/admin/ui/tables/__init__.py +++ b/wagtail/admin/ui/tables/__init__.py @@ -159,6 +159,9 @@ class Column(BaseColumn): context = super().get_cell_context_data(instance, parent_context) value = self.get_value(instance) if isinstance(value, int) and not isinstance(value, bool): + # To prevent errors arising from USE_THOUSAND_SEPARATOR, we require all numbers output + # on templates to be explicitly localized or unlocalized. For numeric table cells, we + # unlocalize them by default; developers may subclass Column to obtain formatted numbers. value = unlocalize(value) context["value"] = value return context