#28619: Handle ValidationError in model saving in admin change views
-------------------------------+--------------------------------------
Reporter: Daniel Hahler | Owner: heba1108
Type: New feature | Status: closed
Component: contrib.admin | Version: 1.11
Severity: Normal | Resolution: wontfix
Keywords: | Triage Stage: Unreviewed
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Comment (by Jerome Leclanche):
Replying to [comment:1 Simon Charette]:
> Raising `ValidationError` during model save isn't a pattern used
anywhere else in the code base. I'm not sure the admin should be different
in this regard.
Actually, it kind of is. ModelForm's `_post_clean` hook usage is a hack
specifically there to work around the inability to raise ValidationError
during save.
In the library I'm working on, an object is created in an upstream API
once the model has been validated locally. When this happens, the upstream
API does its own field validation. The only way to properly raise form
errors in that scenario was to hook into `_post_clean()`.
--
Ticket URL: <https://code.djangoproject.com/ticket/28619#comment:5>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/065.e916113c8a6df862973b15beac0d4fdb%40djangoproject.com.