#28619: Handle ValidationError in change views
-----------------------------------------+------------------------
Reporter: Daniel Hahler | Owner: nobody
Type: New feature | Status: new
Component: contrib.admin | Version: 1.11
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 1
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
Currently ValidationErrors raised in `save_model` and `save_related` are
not handled: the form is considered to be valid, and the error wil
typically bubble up, causing a 500.
A patch/PR is available at: https://github.com/django/django/pull/9113 -
currently no tests are failing because of it.
Some background:
`save_model` typically calls the model's `save` method, but with apps like
django-fsm this might be a custom transition etc, and it is easier to
ensure some state in there (e.g. that a certain field is non-empty when
transitioning the state), especially when the admin is not the main
interface to those transitions.
As for django-fsm-admin (admin integration for django-fsm), it is possible
to hook into the form's `is_valid`, but it would still require an extra
method/callback on the model then: https://github.com/gadventures/django-
fsm-admin/pull/74.
--
Ticket URL: <https://code.djangoproject.com/ticket/28619>
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/050.45490093735f93a5c2cbe48d2d16116d%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.