NetBox 2.9 custom field selection changelog change between WebUI and API #4091

Closed
opened 2025-12-29 18:33:03 +01:00 by adam · 12 comments
Owner

Originally created by @netsandbox on GitHub (Sep 10, 2020).

Originally assigned to: @netsandbox on GitHub.

Environment

  • Python version: 3.6.9
  • NetBox version: 2.9.3

Steps to Reproduce

  1. create a custom field type selection with some values
  2. create a device
  3. set the custom field on the device in the WebUI: the changelog shows the custom field value
  4. change the device status with a API patch request: the changelog shows a custom field value change from value to label

Expected Behavior

The changelog for custom fields of type selection shows always the label, as in NetBox before 2.9

Observed Behavior

The changelog for custom fields of type selection show on WebUI changes the value and on API changes the label (even if the custom field value wasn't changed by the API request).

Changelog of custom field value set via WebUI, custom field value (1) is shown:
netbox_webui_custom_field_value_change

Changelog of status change via API patch request, custom field changes from value (1) to label (D):
netbox_api_status_change

Originally created by @netsandbox on GitHub (Sep 10, 2020). Originally assigned to: @netsandbox on GitHub. <!-- NOTE: IF YOUR ISSUE DOES NOT FOLLOW THIS TEMPLATE, IT WILL BE CLOSED. This form is only for reproducible bugs. If you need assistance with NetBox installation, or if you have a general question, DO NOT open an issue. Instead, post to our mailing list: https://groups.google.com/forum/#!forum/netbox-discuss Please describe the environment in which you are running NetBox. Be sure that you are running an unmodified instance of the latest stable release before submitting a bug report, and that any plugins have been disabled. --> ### Environment * Python version: 3.6.9 * NetBox version: 2.9.3 <!-- Describe in detail the exact steps that someone else can take to reproduce this bug using the current stable release of NetBox. Begin with the creation of any necessary database objects and call out every operation being performed explicitly. If reporting a bug in the REST API, be sure to reconstruct the raw HTTP request(s) being made: Don't rely on a client library such as pynetbox. --> ### Steps to Reproduce 1. create a custom field type selection with some values 2. create a device 3. set the custom field on the device in the WebUI: the changelog shows the custom field **value** 4. change the device status with a API patch request: the changelog shows a custom field value change from **value** to **label** <!-- What did you expect to happen? --> ### Expected Behavior The changelog for custom fields of type selection shows always the label, as in NetBox before 2.9 <!-- What happened instead? --> ### Observed Behavior The changelog for custom fields of type selection show on WebUI changes the value and on API changes the label (even if the custom field value wasn't changed by the API request). Changelog of custom field value set via WebUI, custom field value (1) is shown: ![netbox_webui_custom_field_value_change](https://user-images.githubusercontent.com/165430/92698439-adf80c80-f34c-11ea-9e05-8cc42a768ecf.png) Changelog of status change via API patch request, custom field changes from value (1) to label (D): ![netbox_api_status_change](https://user-images.githubusercontent.com/165430/92698783-1646ee00-f34d-11ea-9949-1ca85805aa3c.png)
adam added the type: bugstatus: accepted labels 2025-12-29 18:33:03 +01:00
adam closed this issue 2025-12-29 18:33:03 +01:00
Author
Owner

@jeremystretch commented on GitHub (Sep 14, 2020):

Thank you for opening a bug report. I was unable to reproduce the reported behavior on the current develop branch: Updating the field via both the web UI and the REST API result in the changelog representation showing the integer value. This was likely changed during work on #5109.

I'm going to close this out as I'm fairly confident it's already been fixed in development, but please ask that it be re-opened if you continue to experience the issue on v2.9.4.

@jeremystretch commented on GitHub (Sep 14, 2020): Thank you for opening a bug report. I was unable to reproduce the reported behavior on the current `develop` branch: Updating the field via both the web UI and the REST API result in the changelog representation showing the integer value. This was likely changed during work on #5109. I'm going to close this out as I'm fairly confident it's already been fixed in development, but please ask that it be re-opened if you continue to experience the issue on v2.9.4.
Author
Owner

@netsandbox commented on GitHub (Sep 14, 2020):

@jeremystretch any chances to restore the old behavior from NetBox 2.8 to show the custom field choice label in the changelog?
Because it is hard to review a change in the changelog if you only see the integer IDs of the custom field choices.

@netsandbox commented on GitHub (Sep 14, 2020): @jeremystretch any chances to restore the old behavior from NetBox 2.8 to show the custom field choice label in the changelog? Because it is hard to review a change in the changelog if you only see the integer IDs of the custom field choices.
Author
Owner

@jeremystretch commented on GitHub (Sep 14, 2020):

Custom fields are being overhauled under #4878, so the entire data model will change in v2.10.

@jeremystretch commented on GitHub (Sep 14, 2020): Custom fields are being overhauled under #4878, so the entire data model will change in v2.10.
Author
Owner

@netsandbox commented on GitHub (Sep 25, 2020):

@jeremystretch I still can replicate this in 2.9.4

curl -sX PATCH -H "Authorization: Token $NETBOX_API_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json; indent=2" "$NETBOX_URL/api/dcim/devices/109/" --data '{"status": "active"}'

netbox_api_status_change

Just to make it clear, I just changed the status by the API request, but the custom field project_status changed from value to label (besides the status change) in the changelog.

@netsandbox commented on GitHub (Sep 25, 2020): @jeremystretch I still can replicate this in 2.9.4 ```shell curl -sX PATCH -H "Authorization: Token $NETBOX_API_TOKEN" -H "Content-Type: application/json" -H "Accept: application/json; indent=2" "$NETBOX_URL/api/dcim/devices/109/" --data '{"status": "active"}' ``` ![netbox_api_status_change](https://user-images.githubusercontent.com/165430/94263750-d62f6000-ff35-11ea-95dc-dde3382f2835.png) Just to make it clear, I just changed the **status** by the API request, but the **custom field project_status** changed from value to label (besides the status change) in the changelog.
Author
Owner

@netsandbox commented on GitHub (Oct 19, 2020):

@jeremystretch can you please re-open this issue as I still can replicate the problem in 2.9.4.

@netsandbox commented on GitHub (Oct 19, 2020): @jeremystretch can you please re-open this issue as I still can replicate the problem in 2.9.4.
Author
Owner

@jeremystretch commented on GitHub (Oct 19, 2020):

FYI custom fields have been overhauled entirely for v2.10, so it's likely this won't be addressed in v2.9.

@jeremystretch commented on GitHub (Oct 19, 2020): FYI custom fields have been overhauled entirely for v2.10, so it's likely this won't be addressed in v2.9.
Author
Owner

@netsandbox commented on GitHub (Oct 20, 2020):

@jeremystretch I can confirm that I don't see this problem in v2.10

I have also found with git bisect the commit that introduced this problem: dd707c97af.
Would be great if you would find time to fix this for v2.9.

@netsandbox commented on GitHub (Oct 20, 2020): @jeremystretch I can confirm that I don't see this problem in v2.10 I have also found with `git bisect` the commit that introduced this problem: dd707c97af7df048db7bb659fa11bc8002115804. Would be great if you would find time to fix this for v2.9.
Author
Owner

@jeremystretch commented on GitHub (Oct 20, 2020):

@cloos would you like to volunteer to take ownership of this issue?

@jeremystretch commented on GitHub (Oct 20, 2020): @cloos would you like to volunteer to take ownership of this issue?
Author
Owner

@netsandbox commented on GitHub (Oct 21, 2020):

@jeremystretch I think I found the problem and can create a PR for this.

@netsandbox commented on GitHub (Oct 21, 2020): @jeremystretch I think I found the problem and can create a PR for this.
Author
Owner

@netsandbox commented on GitHub (Oct 23, 2020):

@jeremystretch I have so far added tests and fixed it for WebUI create and update and API update, but I can't find the place where the cf values are cached for the API create request. Maybe you can give me a hint.

@netsandbox commented on GitHub (Oct 23, 2020): @jeremystretch I have so far added tests and fixed it for WebUI create and update and API update, but I can't find the place where the cf values are cached for the API create request. Maybe you can give me a hint.
Author
Owner

@netsandbox commented on GitHub (Dec 15, 2020):

@jeremystretch as NetBox 2.10 is released, this issue is no longer present and can be closed.

But I would like to provide the tests I have created, so this issue will never happen again.
Can we change the purpose if this issue or should I create a new one for the tests?

@netsandbox commented on GitHub (Dec 15, 2020): @jeremystretch as NetBox 2.10 is released, this issue is no longer present and can be closed. But I would like to provide the tests I have created, so this issue will never happen again. Can we change the purpose if this issue or should I create a new one for the tests?
Author
Owner

@jeremystretch commented on GitHub (Dec 15, 2020):

@cloos You can add a PR to add the tests. I'll leave this issue open to be "fixed" by the PR. Thanks!

@jeremystretch commented on GitHub (Dec 15, 2020): @cloos You can add a PR to add the tests. I'll leave this issue open to be "fixed" by the PR. Thanks!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#4091