Disallow the use of double underscores in a custom field name #7997

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

Originally created by @jonasnieberle on GitHub (May 4, 2023).

Originally assigned to: @arthanson on GitHub.

NetBox version

v3.5.0

Python version

3.8

Steps to Reproduce

  1. Create Custom Field --> Type: Object (Location), Assigned Models: ipam | VLAN
  2. Go to IPAM --> Vlans --> Edit Vlan and chose Location Object by custom Field
  3. In the Vlans overview chosed location not showing, if you click on the specific vlan the location is showing
  4. Same behavior if you assign the custom field to other models like ipam | ip addresses

Expected Behavior

Location from custom Field should be shown in vlan overview

Observed Behavior

Location from custom Field no shown in vlan overview
Netbox_Location_not_show

Location from custom Field only show if you click on the vlan
Netbox_Location_show_in_vlan

Originally created by @jonasnieberle on GitHub (May 4, 2023). Originally assigned to: @arthanson on GitHub. ### NetBox version v3.5.0 ### Python version 3.8 ### Steps to Reproduce 1. Create Custom Field --> Type: Object (Location), Assigned Models: ipam | VLAN 2. Go to IPAM --> Vlans --> Edit Vlan and chose Location Object by custom Field 3. In the Vlans overview chosed location not showing, if you click on the specific vlan the location is showing 4. Same behavior if you assign the custom field to other models like ipam | ip addresses ### Expected Behavior Location from custom Field should be shown in vlan overview ### Observed Behavior Location from custom Field no shown in vlan overview ![Netbox_Location_not_show](https://user-images.githubusercontent.com/100405740/236146915-ac71456d-2753-4dd9-a4b2-c1ade97027d1.PNG) Location from custom Field only show if you click on the vlan ![Netbox_Location_show_in_vlan](https://user-images.githubusercontent.com/100405740/236147323-f6e106c5-4a33-4a06-ad19-a86eef88baf1.PNG)
adam added the type: bugstatus: accepted labels 2025-12-29 20:31:00 +01:00
adam closed this issue 2025-12-29 20:31:00 +01:00
Author
Owner

@kkthxbye-code commented on GitHub (May 4, 2023):

Cannot replicate this, it seems likely that you added the wrong column to the table. Please revise your replication steps.

My test:

image

image

@kkthxbye-code commented on GitHub (May 4, 2023): Cannot replicate this, it seems likely that you added the wrong column to the table. Please revise your replication steps. My test: ![image](https://user-images.githubusercontent.com/400797/236151406-888050e8-8cc1-4e1d-a185-6cb5e99f7a76.png) ![image](https://user-images.githubusercontent.com/400797/236151447-3780e6e9-e757-44d8-a6b4-b8199d73ed49.png)
Author
Owner

@jonasnieberle commented on GitHub (May 4, 2023):

I create another custom Field with another Name and it works.

If I delete the Custom Field Test__Location and recreate the Field with the same Name, I have the same Issue.
Maybe the Name Test__Location trigger anything. Very Strange behaviour.

I would close the bug. Thank you for your time.

@jonasnieberle commented on GitHub (May 4, 2023): I create another custom Field with another Name and it works. If I delete the Custom Field Test__Location and recreate the Field with the same Name, I have the same Issue. Maybe the Name Test__Location trigger anything. Very Strange behaviour. I would close the bug. Thank you for your time.
Author
Owner

@jeremystretch commented on GitHub (May 4, 2023):

I notice that you're using two underscores in the custom field name. This is likely the issue: The table is interpreting the double underscore as a relationship (i.e. test.location) rather than a single field name. Try using a single underscore.

@jeremystretch commented on GitHub (May 4, 2023): I notice that you're using two underscores in the custom field name. This is likely the issue: The table is interpreting the double underscore as a relationship (i.e. `test.location`) rather than a single field name. Try using a single underscore.
Author
Owner

@jonasnieberle commented on GitHub (May 6, 2023):

Perfect, thank you!

@jonasnieberle commented on GitHub (May 6, 2023): Perfect, thank you!
Author
Owner

@jeremystretch commented on GitHub (May 8, 2023):

We should probably prevent the use of double underscores in a custom field name to prevent this issue.

@jeremystretch commented on GitHub (May 8, 2023): We should probably prevent the use of double underscores in a custom field name to prevent this issue.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#7997