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

custom validations before standard ones #905

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

osoukup
Copy link
Contributor

@osoukup osoukup commented Feb 5, 2025

This PR changes the order of the validations. The standard Django validations which were run through full_clean are now postponed after the custom ones. The reason is that the custom ones provide more refined error messages and if we run them after the standard ones the user can get an error which is not really the correct one.

This was the reason why there was one affect validation run in the save method however that was breaking the concept of the AlertMixin where there is an option to suppress the exception and only store the alert. This PR comes as a prerequisite of the orphaned tracker linking where a dummy affects will need to be automatically created and they will possibly be partially invalid due to a missing information. A non-suppressible exception is a blocker.

@osoukup osoukup self-assigned this Feb 5, 2025
@osoukup osoukup changed the title tmp flaw-tracker reunion Feb 5, 2025
which also means that the data conversion must happen
independently outside of the standard validations
@osoukup osoukup changed the title flaw-tracker reunion custom validations before standard ones Feb 12, 2025
@osoukup osoukup added the technical For PRs that introduce changes not worthy of a CHANGELOG entry label Feb 12, 2025
@osoukup osoukup requested a review from a team February 12, 2025 08:59
@osoukup osoukup marked this pull request as ready for review February 12, 2025 08:59
@osoukup
Copy link
Contributor Author

osoukup commented Feb 12, 2025

@jobselko FYI we discussed this quite recently. I have to admit that it was not really easy to change the validation order 😅 but it was necessary so I can later create dummy affects

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
technical For PRs that introduce changes not worthy of a CHANGELOG entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants