-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Open
Labels
complexity: lowRequires minimal effort to implementRequires minimal effort to implementstatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationThis issue is tentatively accepted pending a volunteer committed to its implementationtype: featureIntroduction of new functionality to the applicationIntroduction of new functionality to the application
Description
NetBox version
v4.3.1
Feature type
Change to existing functionality
Proposed functionality
#15104 allows customizing the appearance of dropdown lists in custom scripts for ObjectVars. I'd like to extend this functionality to support any object property or custom field in the context.
Use case
Here are two examples where I would use this in custom scripts.
We use a space_number
custom field on each Location which references an external database run by the real estate team. I'd like to display that as the description like this:
location = ObjectVar(
model=Location,
context={
"description": "cf__space_number",
},
)
Note: that code doesn't work, but it's how I would like it work. If I use id
instead, it looks like this:
Another example, in a PowerOutlet variable, I'd like to display the outlet type like this:
outlet = ObjectVar(
model=PowerOutlet,
context = {
"description": "type.label",
"disabled": "_occupied",
},
)
Database changes
No response
External dependencies
No response
Metadata
Metadata
Assignees
Labels
complexity: lowRequires minimal effort to implementRequires minimal effort to implementstatus: needs ownerThis issue is tentatively accepted pending a volunteer committed to its implementationThis issue is tentatively accepted pending a volunteer committed to its implementationtype: featureIntroduction of new functionality to the applicationIntroduction of new functionality to the application