Custom Scripts with pre-selected DeviceRole #14244
Unanswered
pulsar2022
asked this question in
Help Wanted!
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi, I like to write a custom Script where I can add one or more devices (PC,Printers) to Netbox. The user must type in the PC names and the MAC-Addr. And set the DeviceRole, and here is the Problem, that here is a big dropdown List with many of DeviceRoles. Here i like to have a pre-selected DeviceRole "Workstation".
I had test different things:
device_role = ObjectVar(model=DeviceRole, query_params={'device_id': 25})
and
device_role = ObjectVar(model=DeviceRole, query_params={'device_role': 'Workstation'})
Is there a default pre-selection possible similiar to DeviceStatusChoices? here it works how I need it for DeviceRole:
Active is pre-selected
status = ChoiceVar(DeviceStatusChoices, default=DeviceStatusChoices.STATUS_ACTIVE)
How I can make pre-selection for DeviceRole?
Thank You for any help
Beta Was this translation helpful? Give feedback.
All reactions