Custom fields with double underscore in name behave differently #6375
Replies: 1 comment 2 replies
-
Double-underscores have a special meaning in Django filters: they are used for lookup relationships, e.g.
In principle anything is possible with sufficient effort. Maybe Netbox could be changed to allow such custom field names, e.g. by escaping double-underscore to As for renaming or removing currently broken custom fields: I'd be inclined to do that in SQL. In Netbox v2.10 and later there's a |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
NetBox version
v2.11.3
Python version
Python 3.6.9
I upgraded an instance of Netbox 2.9.1 to 2.11.3 and ran my test scripts. I noticed the following:
Searches including a custom field whos name contains 2 consecutive underscores yield 0 results.
(Even though the data is there and displays fine when not searching for it directly.)
Steps to reproduce:
What I did to make sure I had a clean test:
I tried to renaming both fields to see what that does. The renamed 'test__double' field's values are now null. Not a working solution:
I decided we could migrate data to new fields and delete the old ones.
However, the problematic custom field doesn't seem to delete correctly:
I'm unsure how to proceed in a clean manner, other than creating an entirely new instance and migrating all data. Before doing all that, though: Was using these names a mistake on our part that we could have known about, or did we run into a bug / something that changed in later versions?
Not sure if it matters, but I also upgraded a clone of our prod box from 2.9.1 to 2.10.5 to see if it works there. (2.9.2 through 2.10.4 failed with a pip version error, even after manually upgrading it in the venv. The upgrade.sh changes in 2.10.5 fixed that). The field also fails there. That at least narrows down the problematic version, I hope.
Beta Was this translation helpful? Give feedback.
All reactions