Replies: 1 comment 1 reply
-
I believe the event is triggered after the action, so there's no way around that. A custom plugin could register a pre_save signal to the VirtualMachine model, so it's technically possible, but probably not what you're looking for. Another option is to look into using Custom Validation as a way to enforce consistency. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Use case: Let's say we want to create a virtual machine. When you create a VM, after clicking the 'create' button, you are taken to the object you just created.
We have a script that runs after objected created or object updated that reformats any charfield or textfield into all lowercase.
"TEST" becomes "test"
"Testing Server" becomes "testing server", etc.
The scripts works exactly how we want, except we notice that after creating/updating an object, the netbox GUI will redirect us to the object we just created/updated and the wrongly formatted text is displayed. Only after refreshing the page do we see the results of the script doing its job and reformatting everything.
The question is, is there a way for the script to be able to run and reformat the text prior to displaying the object in the gui?
The script:
Beta Was this translation helpful? Give feedback.
All reactions