Ver Fonte

Add clarifying comment to Column

Matt Westcott há 7 meses atrás
pai
commit
2b96c3e364
1 ficheiros alterados com 3 adições e 0 exclusões
  1. 3 0
      wagtail/admin/ui/tables/__init__.py

+ 3 - 0
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