How to mark "platform" field as required in the Web UI? #12321
Replies: 2 comments
-
I don't have an answer to this but would like to express interest in this too as I found that some fields such as "Role" are mandatory but not marked as such in the UI |
Beta Was this translation helpful? Give feedback.
-
I think this is a normal behavior, because the custom validator validates the data when you press the submit/add buttom. The custom validator don't have a connection to the UI. I think it's very tricky to connect the UI and the custom validator, because you can validate everything you can code with python. How can the UI know what you validate .... Except you validate with default stuff like required or something else ... maybe the UI can check the custom validation before rendering, but I think it's not schedulded ... |
Beta Was this translation helpful? Give feedback.
-
Hi,
I want to declare the platform field of the device object as required.
I found that this can be done with custom validators so i use the following in the configuration.py file:
CUSTOM_VALIDATORS = {'dcim.device': [{'platform': {'required': True}}]}
The validation works as expected: When adding a new device in the "Add a new device" form or in the "Device Bulk Import" is mandatory to fill in the platform field to create a device:
But, in the Web UI the "platform" field doesn't appear in bold and with the "*" symbol as other mandatory fields:
How can I fix this?
Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions