Replies: 1 comment 1 reply
-
Formatting is handled automatically by the |
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
-
I'm working with my developer to create a custom script that will automatically reformat certain text on objects for an 'object create' or 'object update' action.
The problem I'm seeing is that the script runs after the object has been created, and netbox displays the object you just created which shows the incorrect formatting. But if you refresh the page, the formatting is fixed because the custom script has been run and fixed it.
But when you input a MAC address on an interface, and you give it a format that netbox doesn't like (for example 1111.2222.3333) netbox will automatically reformat the MAC address as (11:11:22:22:33:33). The trick here is that NetBox reformats the MAC address behind the scenes, so when you click save, then netbox shows you the preview of what you just did, the MAC address has already been fixed.
How is NetBox updating values of a field after you click save, but before it displays the page to you? Right now we're using the item.save() method, but I'm wondering if there is something else we can be using?
I'm wanting to point my developer to the code in NetBox where the MAC address reformatting is happening so perhaps he can see how NetBox is doing the update before displaying the object on screen.
Beta Was this translation helpful? Give feedback.
All reactions