Ticket #3293: interger_field.patch
File interger_field.patch, 853 bytes (added by , 18 years ago) |
---|
-
django/newforms/fields.py
118 118 """ 119 119 super(IntegerField, self).clean(value) 120 120 if not self.required and value in EMPTY_VALUES: 121 return u''121 return None 122 122 try: 123 123 value = int(value) 124 124 except (ValueError, TypeError): -
tests/regressiontests/forms/tests.py
770 770 771 771 >>> f = IntegerField(required=False) 772 772 >>> f.clean('') 773 u''774 773 >>> f.clean(None) 775 u''776 774 >>> f.clean('1') 777 775 1 778 776 >>> isinstance(f.clean('1'), int)