#22739: CharField for Forms raises on empty string
----------------------------+--------------------
     Reporter:  jeremyt     |      Owner:  nobody
         Type:  Bug         |     Status:  new
    Component:  Forms       |    Version:  1.6
     Severity:  Normal      |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0           |      UI/UX:  0
----------------------------+--------------------
 forms.CharField raises a ValidationError when the min_length is zero and
 it receives an empty string. Receiving an empty string is not the same as
 the argument not being present in the arguments.

 In cases,
     PUT requests on a REST resource. Not sending a CharField means, do
 nothing to that field but sending a blank string is an attempt to set a
 field to an empty string.

   In a web form, I may want to require a field be present in the POST data
 as it is a part of my form but it may be blank/empty. If that field is not
 present, this means that the data isn't returning the fields in which I
 have set as required.


 {{{
 >>> from django import forms
 >>> forms.CharField(min_length=0).clean("")
 django.core.exceptions.ValidationError: [u'This field is required.']
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/22739>
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.49404688db41430d80a783bcdb489d1b%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to