Repository: wagtail/wagtail
File: wagtail/admin/ui/tables/__init__.py (Python)

Code before:
        if callable(self.accessor):
            return self.accessor(instance)
        else:
            try:
                return multigetattr(instance, self.accessor)
            except AttributeError:
                return None

    def get_cell_context_data(self, instance, parent_context):
        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


class NumberColumn(Column):
    """A specialised column that displays numbers with locale-aware formatting"""

    def get_value(self, instance):
        value = super().get_value(instance)
        return intcomma(value)


class ButtonsColumnMixin:
    """A mixin for columns that contain buttons"""

    buttons = []

    def get_cell_context_data(self, instance, parent_context):
        context = super().get_cell_context_data(instance, parent_context)
        context["buttons"] = sorted(self.get_buttons(instance, parent_context))
        return context

    def get_buttons(self, instance, parent_context):
        return self.buttons


class TitleColumn(Column):
    """A column where data is styled as a title and wrapped in a link or <label>"""

    cell_template_name = "wagtailadmin/tables/title_cell.html"

    def __init__(
        self,
        name,
        url_name=None,

Review comment (suggestion):
I know I suggested overriding `get_value()`, but looking at the other columns it seems more common to override the displayed value via `get_cell_context_data()`. Perhaps so that you can still access the machine-friendly value (number) by calling `get_value()`.

Code after:
        displayed in a cell of this column
        """
        if callable(self.accessor):
            return self.accessor(instance)
        else:
            try:
                return multigetattr(instance, self.accessor)
            except AttributeError:
                return None

    def get_cell_context_data(self, instance, parent_context):
        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)

        if not str(value).strip():
            context["value"] = self.empty_value_display
        else:
            context["value"] = value
        return context


class NumberColumn(Column):
    """A specialised column that displays numbers with locale-aware formatting"""

    def get_cell_context_data(self, instance, parent_context):
        context = super().get_cell_context_data(instance, parent_context)
        context["value"] = intcomma(context["value"])
        return context


class ButtonsColumnMixin:
    """A mixin for columns that contain buttons"""

    buttons = []

    def get_cell_context_data(self, instance, parent_context):
        context = super().get_cell_context_data(instance, parent_context)
        context["buttons"] = sorted(self.get_buttons(instance, parent_context))
        return context

    def get_buttons(self, instance, parent_context):
        return self.buttons


class TitleColumn(Column):
    """A column where data is styled as a title and wrapped in a link or <label>"""