You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Custom validators to be able to apply validation rules to many-to-many fields, such as prefix locations or tags.
So that ...
Custom Validators will support compliance for many-to-many fields, allowing app developers to define compliance rules for these fields.
I know this is done when...
When creating a custom validator, the self.context['object'] provides the user's selections from the form. However, for many-to-many fields like tags, instead of getting the user's current form choices, we are getting the existing data from the database. To resolve this, we need access to the many-to-many fields within self.context['object']. For example, when a user edits a prefix, self.context['object'].locations should reflect the user's current selection, not the existing locations associated with the prefix.
Optional - Feature groups this request pertains to.
Automation
Circuits
DCIM
IPAM
Misc (including Data Sources)
Organization
Apps (and other Extensibility)
Security (Secrets, etc)
Image Management
UI/UX
Documentation
Other (not directly a platform feature)
Database Changes
No additional models or fields are required.
External Dependencies
No additional external dependencies are required.
The text was updated successfully, but these errors were encountered:
Because updating many-to-many fields is a separate database operation from saving the object itself, this is not as straightforward to design/implement as it might seem. I get the desire/need for this functionality though.
As ...
P.D. - Nautobot App Developer
I want ...
Custom validators to be able to apply validation rules to many-to-many fields, such as prefix locations or tags.
So that ...
Custom Validators will support compliance for many-to-many fields, allowing app developers to define compliance rules for these fields.
I know this is done when...
When creating a custom validator, the
self.context['object']
provides the user's selections from the form. However, for many-to-many fields like tags, instead of getting the user's current form choices, we are getting the existing data from the database. To resolve this, we need access to the many-to-many fields withinself.context['object']
. For example, when a user edits a prefix,self.context['object'].locations
should reflect the user's current selection, not the existing locations associated with the prefix.Optional - Feature groups this request pertains to.
Database Changes
No additional models or fields are required.
External Dependencies
No additional external dependencies are required.
The text was updated successfully, but these errors were encountered: