Ticket #8898: 8898-DateTimeField-r8983.diff
File 8898-DateTimeField-r8983.diff, 2.1 KB (added by , 16 years ago) |
---|
-
django/forms/fields.py
379 379 if isinstance(value, list): 380 380 # Input comes from a SplitDateTimeWidget, for example. So, it's two 381 381 # components: date and time. 382 if not [v for v in value if v not in EMPTY_VALUES]: 383 if self.required: 384 raise ValidationError(self.error_messages['required']) 385 return None 382 386 if len(value) != 2: 383 387 raise ValidationError(self.error_messages['invalid']) 384 388 value = '%s %s' % tuple(value) -
tests/regressiontests/forms/fields.py
619 619 >>> repr(f.clean('')) 620 620 'None' 621 621 622 Regression test for #8898. 623 >>> f = DateTimeField(widget=SplitDateTimeWidget) 624 >>> f.clean(['', '']) 625 Traceback (most recent call last): 626 ... 627 ValidationError: [u'This field is required.'] 628 >>> f = DateTimeField(required=False, widget=SplitDateTimeWidget) 629 >>> repr(f.clean(['', ''])) 630 'None' 631 622 632 # RegexField ################################################################## 623 633 624 634 >>> f = RegexField('^\d[A-F]\d$') -
AUTHORS
239 239 Eugene Lazutkin <http://lazutkin.com/blog/> 240 240 lcordier@point45.com 241 241 Jeong-Min Lee <falsetru@gmail.com> 242 Tai Lee <real.human@mrmachine.net> 242 243 Jannis Leidel <jl@websushi.org> 243 244 Christopher Lenz <http://www.cmlenz.net/> 244 245 lerouxb@gmail.com … … 278 279 Aljosa Mohorovic <aljosa.mohorovic@gmail.com> 279 280 Ramiro Morales <rm0@gmx.net> 280 281 Eric Moritz <http://eric.themoritzfamily.com/> 281 mrmachine <real.human@mrmachine.net>282 282 Robin Munn <http://www.geekforgod.com/> 283 283 James Murty 284 284 msundstr