Modernize datagrid columns, fix bugs, and add JSON serialization.

Review Request #14844 — Created Feb. 20, 2026 and updated

Information

Review Board
release-7.1.x

Reviewers

This is a major update to the existing datagrid columns, largely
preparing them for the new Dashboard API resource, and fixing up a
number of issues in their implementation.

All columns now provide a stable JSON representation that can be used in
the API, returning structured data, API-compatible objects (which will
be turned into payloads or links), or raw values.

In some cases, this is done by overriding the new to_json(), but in
most we just now calculate the state for both the JSON and HTML
representations in the column-controlled get_raw_object_value(). This
keeps the data calculation in one place, and simplifies both output
functions (often using default logic).

HTML rendering has been fixed in all places to correctly use
format_html() or escape() for results. This will future-proof these
columns for when the datagrid code starts escaping non-SafeStrings.

Most of the __init__() methods are now gone, instead using the new
class-defined attributes. This is much easier to maintain and
specialize.

Types have been fixed and annotated all throughout, catching issues in
some of the logic.

Many bugs (such as extra spaces at the end of values, wrong data types
being returned where strings are expected) that weren't previously
caught have been fixed, with tests updated to strictly check return
types.

Unit tests pass.

Tested all columns in the dashboard in both the browser and with
a test script using the in-progress dashboard API.

Summary ID
Modernize datagrid columns, fix bugs, and add JSON serialization.
This is a major update to the existing datagrid columns, largely preparing them for the new Dashboard API resource, and fixing up a number of issues in their implementation. All columns now provide a stable JSON representation that can be used in the API, returning structured data, API-compatible objects (which will be turned into payloads or links), or raw values. In some cases, this is done by overriding the new `to_json()`, but in most we just now calculate the state for both the JSON and HTML representations in the column-controlled `get_raw_object_value()`. This keeps the data calculation in one place, and simplifies both output functions (often using default logic). HTML rendering has been fixed in many places to correctly use `format_html()` when we're constructing actual HTML to display. This will future-proof these columns for when the datagrid code starts escaping non-SafeStrings. Most of the `__init__()` methods are now gone, instead using the new class-defined attributes. This is much easier to maintain and specialize. Types have been fixed and annotated all throughout, catching issues in some of the logic. Many bugs (such as extra spaces at the end of values, wrong data types being returned where strings are expected) that weren't previously caught have been fixed, with tests updated to strictly check return types.
826620197224da1889c20928695d233654abe1f7
Checks run (2 succeeded)
flake8 passed.
JSHint passed.