Default value for Custom Field is not displayed #5115

Closed
opened 2025-12-29 19:24:25 +01:00 by adam · 3 comments
Owner

Originally created by @sdktr on GitHub (Jul 28, 2021).

NetBox version

v3.0-beta1

Python version

3.8

Steps to Reproduce

  1. Create a Custom Field with type text, assign to dcim_device
    image

  2. Assign a default value like: "mydefaulttextvalue"
    image

  3. Open any device and view CustomFields

Expected Behavior

The default value is displayed on the UI

Observed Behavior

Dashes are displayed as default value:
image

Originally created by @sdktr on GitHub (Jul 28, 2021). ### NetBox version v3.0-beta1 ### Python version 3.8 ### Steps to Reproduce 1. Create a Custom Field with type text, assign to dcim_device ![image](https://user-images.githubusercontent.com/19833687/127393189-4b6e6148-25f6-4a14-85ec-6491f8c59de9.png) 2. Assign a default value like: "mydefaulttextvalue" ![image](https://user-images.githubusercontent.com/19833687/127393723-1303dec2-4f6c-4500-90f1-641688d8daa4.png) 3. Open any device and view CustomFields ### Expected Behavior The default value is displayed on the UI ### Observed Behavior Dashes are displayed as default value: ![image](https://user-images.githubusercontent.com/19833687/127393318-de427a0e-f75d-4ac8-b9da-8a08dd726cb2.png)
adam added the type: bugstatus: duplicatebeta labels 2025-12-29 19:24:25 +01:00
adam closed this issue 2025-12-29 19:24:25 +01:00
Author
Owner

@ifoughal commented on GitHub (Jul 29, 2021):

Was about to open an issue regarding this.

I do not believe that this is a bug, but more of lack of object instantiation on preexisting objects.

The way it currently work right now is that the custom_fields get hooked to the object types that are assigned to it, but the actual default values that is set on the admin panel does get updated, thus properly instantiated on the pre existing nodes.

Although, if you create a new object, the custom_field will get instantiated on it.

Adding such a functionality would be very helpful and would save us time, as of currently, I was thinking about hooking a custom script to update all of the custom_fields default values on pre existing objects. and would manually trigger it every time I create a new custom field.

@ifoughal commented on GitHub (Jul 29, 2021): Was about to open an issue regarding this. I do not believe that this is a bug, but more of lack of object instantiation on preexisting objects. The way it currently work right now is that the custom_fields get hooked to the object types that are assigned to it, but the actual default values that is set on the admin panel does get updated, thus properly instantiated on the pre existing nodes. Although, if you create a new object, the custom_field will get instantiated on it. Adding such a functionality would be very helpful and would save us time, as of currently, I was thinking about hooking a custom script to update all of the custom_fields default values on pre existing objects. and would manually trigger it every time I create a new custom field.
Author
Owner

@jsenecal commented on GitHub (Jul 29, 2021):

This could also be implemented using a manage.py management command, which could be run manually on specific models when needed.

@jsenecal commented on GitHub (Jul 29, 2021): This could also be implemented using a `manage.py` management command, which could be run manually on specific models when needed.
Author
Owner

@jeremystretch commented on GitHub (Jul 29, 2021):

Seems like this is already captured under #6725; it happens on v2.11 as well.

@jeremystretch commented on GitHub (Jul 29, 2021): Seems like this is already captured under #6725; it happens on v2.11 as well.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5115