Ticket #4317: fields.diff
File fields.diff, 832 bytes (added by , 18 years ago) |
---|
-
django/newforms/fields.py
489 489 super(SplitDateTimeField, self).__init__(fields, *args, **kwargs) 490 490 491 491 def compress(self, data_list): 492 if data_list: 492 d,t = tuple(data_list) 493 error,empty = False,False 494 if d in EMPTY_VALUES: 495 if t not in EMPTY_VALUES: 496 error = True 497 else: 498 empty = True 499 elif t in EMPTY_VALUES: 500 error = True 501 502 if error: 503 raise ValidationError(gettext(u'Please enter both a date and a time.')) 504 if not empty: 493 505 return datetime.datetime.combine(*data_list) 494 506 return None