Extend BooleanColumn to allow rendering a placeholder for false values #9991

Closed
opened 2025-12-29 21:25:21 +01:00 by adam · 0 comments
Owner

Originally created by @jeremystretch on GitHub (Jul 17, 2024).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v4.0.7

Feature type

New functionality

Proposed functionality

Currently, NetBox's custom BooleanColumn will render a checkmark for true values, an X for false values, and a placeholder for null values.

This FR proposes new keyword arguments which enable overriding the default HTML content for true and false values. Setting either of these to None will render an empty placeholder, as with null values.

foo = columns.BooleanColumn(
    true_content='Yup',
    false_content=None
)

Use case

Sometimes a negative condition is not inherently problematic, and is not appropriate to flag as "wrong" using a red X. For example, consider the "management only" field on the interface model. We care to indicate when an interface has been so designated, but otherwise this attribute needs no further attention. (Contrast this to the "enabled" field, wherein a false value is likely more worthy of consideration.)

Database changes

None

External dependencies

None

Originally created by @jeremystretch on GitHub (Jul 17, 2024). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v4.0.7 ### Feature type New functionality ### Proposed functionality Currently, NetBox's custom [BooleanColumn](https://github.com/netbox-community/netbox/blob/0830ebb34aef74e0af4b6ab6f9f18284c5096050/netbox/netbox/tables/columns.py#L192) will render a checkmark for true values, an X for false values, and a placeholder for null values. This FR proposes new keyword arguments which enable overriding the default HTML content for true and false values. Setting either of these to None will render an empty placeholder, as with null values. ```python foo = columns.BooleanColumn( true_content='Yup', false_content=None ) ``` ### Use case Sometimes a negative condition is not inherently problematic, and is not appropriate to flag as "wrong" using a red X. For example, consider the "management only" field on the interface model. We care to indicate when an interface has been so designated, but otherwise this attribute needs no further attention. (Contrast this to the "enabled" field, wherein a false value is likely more worthy of consideration.) ### Database changes None ### External dependencies None
adam added the status: acceptedtype: featurecomplexity: low labels 2025-12-29 21:25:21 +01:00
adam closed this issue 2025-12-29 21:25:21 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#9991