Ticket #3408: __init__.py.2.diff
File __init__.py.2.diff, 1000 bytes (added by , 18 years ago) |
---|
-
__init__.py
437 437 Field.__init__(self, verbose_name, name, **kwargs) 438 438 439 439 def to_python(self, value): 440 if value is None: 441 if self.null: 442 return value 443 else: 444 raise validators.ValidationError, gettext_lazy("This field cannot be null.") 440 445 if isinstance(value, datetime.datetime): 441 446 return value.date() 442 447 if isinstance(value, datetime.date): … … 499 504 500 505 class DateTimeField(DateField): 501 506 def to_python(self, value): 507 if value is None: 508 if self.null: 509 return value 510 else: 511 raise validators.ValidationError, gettext_lazy("This field cannot be null.") 502 512 if isinstance(value, datetime.datetime): 503 513 return value 504 514 if isinstance(value, datetime.date):