I'd like to inform the user if something fails during processing of the data in instance in my pre_save receiver function.
Is it possible to raise a custom ValidationError from the receiver function? If not, how would I go about implementing something like this?
You can raise whatever exception you want within the pre_save listener function, it will propagate to your save() call and prevent it from suceeding.
It will bubble up to where you call save(), from here, you can catch it (try/except…) and notify the user.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With