Ticket #3482: 3482.diff

File 3482.diff, 936 bytes (added by Jeff Bauer <jbauer@…>, 9 years ago)

replaces 4490.diff patch

  • django/newforms/fields.py

     
    374374            raise ValidationError(gettext(u'This field is required.'))
    375375        elif not self.required and not value:
    376376            return []
     377        elif not self.required and len(value) == 1 and not value[0]:
     378            return []
    377379        if not isinstance(value, (list, tuple)):
    378380            raise ValidationError(gettext(u'Enter a list of values.'))
    379381        new_value = []
  • tests/regressiontests/forms/tests.py

     
    16021602[]
    16031603>>> f.clean(None)
    16041604[]
     1605>>> f.clean([''])
     1606[]
    16051607>>> f.clean([1])
    16061608[u'1']
    16071609>>> f.clean(['1'])
Back to Top