#30861: Support for ValidationWarning
---------------------------------------+----------------------------
Reporter: Dylan Young | Owner: nobody
Type: New feature | Status: new
Component: Forms | Version: 2.2
Severity: Normal | Keywords: validation
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 1
UI/UX: 1 |
---------------------------------------+----------------------------
A `ValidationWarning` would work like a `ValidationError`, except that
they wouldn't prevent form save and would be able to substitute an
alternate value in the form to address the warning.
I'm happy to implement if we can get the go-ahead here.
This is one of the areas of missing support in Django that has plagued us
since 1.4.
Hacking around this is painful. The only way that I know of to achieve
the desired functionality, say when extending an existing model field with
a new clean method, is by subclassing both the widget (to transform the
output) and the field (to raise the ValidationError / send the message...
Moreover, if going the message route, we also need access to the
request!!!). This is just plain silliness.
Probably it would be useful to be able to control whether it saves or not,
defaulting to `save=True` since it is a "warning". Alternatively,
allowing ValidationError to transform the input value would likely be more
semantic than a `save` kwarg to ValidationWarning. A `level` kwarg might
be valuable too (to set the default message level of the resulting
message).
--
Ticket URL: <https://code.djangoproject.com/ticket/30861>
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/053.821c3410dfd220b0fbec0a1ff4fdfacb%40djangoproject.com.