JSONField loses styling if custom help_text is passed #10956

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

Originally created by @jeremystretch on GitHub (Mar 27, 2025).

Originally assigned to: @jeremystretch on GitHub.

Deployment Type

Self-hosted

NetBox Version

v4.2.6

Python Version

3.10

Steps to Reproduce

  1. Open the form to create a custom field
  2. Select "object" for the type of field
  3. Enter something in the "related object filter field"

Expected Behavior

The form field should use a monospace text to preserve formatting.

Observed Behavior

The form field uses regular text. This is due to a bug in the field's init method, which applies the font-monospace CSS class only if the default help_text is used: e1e514251e/netbox/utilities/forms/fields/fields.py (L98-L103)

Originally created by @jeremystretch on GitHub (Mar 27, 2025). Originally assigned to: @jeremystretch on GitHub. ### Deployment Type Self-hosted ### NetBox Version v4.2.6 ### Python Version 3.10 ### Steps to Reproduce 1. Open the form to create a custom field 2. Select "object" for the type of field 3. Enter something in the "related object filter field" ### Expected Behavior The form field should use a monospace text to preserve formatting. ### Observed Behavior The form field uses regular text. This is due to a bug in the field's init method, which applies the `font-monospace` CSS class only if the default `help_text` is used: https://github.com/netbox-community/netbox/blob/e1e514251e825fadfcc87a191502a931fa9edb5b/netbox/utilities/forms/fields/fields.py#L98-L103
adam added the type: bugstatus: acceptedseverity: low labels 2025-12-29 21:38:22 +01:00
adam closed this issue 2025-12-29 21:38:22 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#10956