Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #11032 - Replication fields broken in custom validation #11698

Conversation

kkthxbye-code
Copy link
Contributor

Fixes: #11032

The issue here is that validation is triggered on the base instance when the form uses replication_fields. So if the user creates a vminterface with name test[1-2] validation is triggered for:

VMInterface with no name
VMInterface with name test1
VMInterface with name test2

For the normal validation this works okay, but for custom validation it results in the validator being triggered for the first VMInterface which is never actually saved. Not sure if there is a smarter way to fix this, my approach is to tag the instance that is never going to be saved with a private variable and make sure we don't run custom validators for these instances.

@jeremystretch
Copy link
Member

To really resolve this, we'll need to overhaul the manner in which component replication forms are built and processed; I've opened #11707 to address this. For now, this seems like a reasonable stop-gap. Thanks!

@jeremystretch jeremystretch merged commit 91705aa into netbox-community:develop Feb 8, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Replication fields broken in custom validation
2 participants