From eed2445d02071b8503514ed232c47a8434c6ad12 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Honza=20Kr=C3=A1l?= Date: Wed, 3 Jun 2009 02:37:36 +0000 Subject: [PATCH] [soc2009/model-validation] Date based fields git-svn-id: http://code.djangoproject.com/svn/django/branches/soc2009/model-validation@10905 bcc190cf-cafb-0310-a4f2-bffc1f526a37 --- django/forms/fields.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/django/forms/fields.py b/django/forms/fields.py index 449ebc8216..74f4a2ba48 100644 --- a/django/forms/fields.py +++ b/django/forms/fields.py @@ -314,12 +314,11 @@ class DateField(Field): super(DateField, self).__init__(*args, **kwargs) self.input_formats = input_formats or DEFAULT_DATE_INPUT_FORMATS - def clean(self, value): + def to_python(self, value): """ Validates that the input can be converted to a date. Returns a Python datetime.date object. """ - super(DateField, self).clean(value) if value in EMPTY_VALUES: return None if isinstance(value, datetime.datetime): @@ -348,12 +347,11 @@ class TimeField(Field): super(TimeField, self).__init__(*args, **kwargs) self.input_formats = input_formats or DEFAULT_TIME_INPUT_FORMATS - def clean(self, value): + def to_python(self, value): """ Validates that the input can be converted to a time. Returns a Python datetime.time object. """ - super(TimeField, self).clean(value) if value in EMPTY_VALUES: return None if isinstance(value, datetime.time): @@ -387,12 +385,11 @@ class DateTimeField(Field): super(DateTimeField, self).__init__(*args, **kwargs) self.input_formats = input_formats or DEFAULT_DATETIME_INPUT_FORMATS - def clean(self, value): + def to_python(self, value): """ Validates that the input can be converted to a datetime. Returns a Python datetime.datetime object. """ - super(DateTimeField, self).clean(value) if value in EMPTY_VALUES: return None if isinstance(value, datetime.datetime):