[Django] #30861: Support for ValidationWarning

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Django] #30861: Support for ValidationWarning

Django
#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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/053.821c3410dfd220b0fbec0a1ff4fdfacb%40djangoproject.com.
Reply | Threaded
Open this post in threaded view
|

Re: [Django] #30861: Support for ValidationWarning

Django
#30861: Support for ValidationWarning
-----------------------------+--------------------------------------
     Reporter:  Dylan Young  |                    Owner:  nobody
         Type:  New feature  |                   Status:  closed
    Component:  Forms        |                  Version:  2.2
     Severity:  Normal       |               Resolution:  duplicate
     Keywords:  validation   |             Triage Stage:  Unreviewed
    Has patch:  0            |      Needs documentation:  0
  Needs tests:  0            |  Patch needs improvement:  0
Easy pickings:  1            |                    UI/UX:  1
-----------------------------+--------------------------------------
Changes (by Simon Charette):

 * status:  new => closed
 * resolution:   => duplicate


Comment:

 Duplicate of #23.

 [https://docs.djangoproject.com/en/2.2/internals/contributing/bugs-and-
 features/#reporting-bugs-and-requesting-features This should be brought up
 on the mailing list] if you think the decision of closing #23 should be
 revisited.

--
Ticket URL: <https://code.djangoproject.com/ticket/30861#comment:1>
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 [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/068.a6d14f8907179372eaa0b270eef02171%40djangoproject.com.