render_field does not show the custom "label" if set #7239

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

Originally created by @PieterL75 on GitHub (Nov 16, 2022).

Originally assigned to: @jeremystretch on GitHub.

NetBox version

v3.3.7

Python version

3.9

Steps to Reproduce

  1. create a form that uses the render_field and provides a custom label
  2. {% render_field form.provider_network_provider label="Provider" %}
  3. Open the page.

Expected Behavior

The custom label is shown in front of the widgets

Observed Behavior

The original fieldname is shown, and not the custom label.
94c7f64baf/netbox/utilities/templatetags/form_helpers.py (L37)
allows to set a 'label' and returns it as a separate variable to the "form_helpers/render_field.html"
This form however always uses the 'field.label' and not the 'label' variable
There is a reference to the 'label' variable, but only for textarea's

Can we have the 'label' parameter always be displayed ?
My suggestion is to set the 'label' variable to the 'field.label' in 'def render_field' and then in the html always refer to label, rather than field.label

Originally created by @PieterL75 on GitHub (Nov 16, 2022). Originally assigned to: @jeremystretch on GitHub. ### NetBox version v3.3.7 ### Python version 3.9 ### Steps to Reproduce 1. create a form that uses the render_field and provides a custom label 2. {% render_field form.provider_network_provider label="Provider" %} 3. Open the page. ### Expected Behavior The custom label is shown in front of the widgets ### Observed Behavior The original fieldname is shown, and not the custom label. https://github.com/netbox-community/netbox/blob/94c7f64bafcbaac533b0a5b260f17f82a8c9d667/netbox/utilities/templatetags/form_helpers.py#L37 allows to set a 'label' and returns it as a separate variable to the "form_helpers/render_field.html" This form however always uses the 'field.label' and not the 'label' variable There is a reference to the 'label' variable, but only for textarea's Can we have the 'label' parameter always be displayed ? My suggestion is to set the 'label' variable to the 'field.label' in 'def render_field' and then in the html always refer to label, rather than field.label
adam added the type: bugstatus: accepted labels 2025-12-29 20:20:45 +01:00
adam closed this issue 2025-12-29 20:20:45 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7239