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 #12731: Support custom validation for many-to-many fields #14516

Merged
merged 6 commits into from
Dec 22, 2023

Conversation

jeremystretch
Copy link
Member

@jeremystretch jeremystretch commented Dec 13, 2023

Fixes: #12731

  • Override _post_clean() on NetBoxModelForm to store M2M field values on the cleaned instance for reference
  • Extend BulkEditVIew to store M2M fields for validation
  • Extend validate() on ValidatedModelSerializer similar to what we did for forms
  • Introduce a _getattr() method on CustomValidator to reference the _m2m_values instance attribute when evaluating rules which reference many-to-many fields
  • Add tests for custom validation of M2M fields for model forms and serializers

@jeremystretch jeremystretch marked this pull request as ready for review December 21, 2023 20:08
@jeremystretch jeremystretch merged commit 99467e8 into develop Dec 22, 2023
8 checks passed
@jeremystretch jeremystretch deleted the 12731-m2m-validation branch December 22, 2023 15:01
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 22, 2024
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.

Custom validators unable to validate tag presence
1 participant