Ticket #3293: interger_field.patch

File interger_field.patch, 853 bytes (added by Honza Král <Honza.Kral@…>, 18 years ago)
  • django/newforms/fields.py

     
    118118        """
    119119        super(IntegerField, self).clean(value)
    120120        if not self.required and value in EMPTY_VALUES:
    121             return u''
     121            return None
    122122        try:
    123123            value = int(value)
    124124        except (ValueError, TypeError):
  • tests/regressiontests/forms/tests.py

     
    770770
    771771>>> f = IntegerField(required=False)
    772772>>> f.clean('')
    773 u''
    774773>>> f.clean(None)
    775 u''
    776774>>> f.clean('1')
    7777751
    778776>>> isinstance(f.clean('1'), int)
Back to Top