Is there a way to set multiple database fields from one dropdown #15038
-
Hi there, I am currently working on a ptp plugin for netbox. The data structure looks as follows:
So my requirement would be to set the value of ptp_profile in a rendered drop down menu and when I set hte ptp_profile value the values of log_ptp_sync_interval, log_ptp_announce_interval and log_ptp_delayreq_interval will automaticly set to a pre defined value from the ptp profile. For Example if ptp_profile would be 0 (SMPTE-2059-2) the three values should be set accordingly: log_ptp_sync_interval = -3 Is this even possible and is there a way to achieve such a behavior? Best regards Stefan |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Aside: please can you edit your post and put three backticks (
If you want to do this in the model, you can just hook into the
(This approach would mean not setting an explicit default value of 0, and instead letting the None value propagate so that If you are talking about a form displayed on-screen, and you want a click on one selection menu to trigger updates to other selection menus, then that's harder - at that point you're messing about with Javascript. |
Beta Was this translation helpful? Give feedback.
There is a concrete example of this in the Interface wifi attributes, in
netbox/dcim/models/device_components.py