Custom validation should use pre_save signal #5974

Closed
opened 2025-12-29 19:35:04 +01:00 by adam · 1 comment
Owner

Originally created by @jeremystretch on GitHub (Jan 20, 2022).

Originally assigned to: @jeremystretch on GitHub.

Proposed Changes

Connect the run_custom_validators() receiver to the Django's built-in pre_save signal instead of our custom post_clean signal.

Justification

This simplifies the custom validation process a bit, and ensures that custom validators are run only after the entire clean() method has completed.

Originally created by @jeremystretch on GitHub (Jan 20, 2022). Originally assigned to: @jeremystretch on GitHub. ### Proposed Changes Connect the `run_custom_validators()` receiver to the Django's built-in `pre_save` signal instead of our custom `post_clean` signal. ### Justification This simplifies the custom validation process a bit, and ensures that custom validators are run only after the entire `clean()` method has completed.
adam added the type: housekeeping label 2025-12-29 19:35:04 +01:00
adam closed this issue 2025-12-29 19:35:04 +01:00
Author
Owner

@jeremystretch commented on GitHub (Jan 20, 2022):

I recall now why we didn't do this originally: We can't cleanly capture a validation error after pre_save has fired.

@jeremystretch commented on GitHub (Jan 20, 2022): I recall now why we didn't do this originally: We can't cleanly capture a validation error after `pre_save` has fired.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#5974