Author: Honza_Kral
Date: 2009-06-02 21:37:36 -0500 (Tue, 02 Jun 2009)
New Revision: 10905
Modified:
django/branches/soc2009/model-validation/django/forms/fields.py
Log:
[soc2009/model-validation] Date based fields
Modified: django/branches/soc2009/model-validation/django/forms/fields.py
===================================================================
--- django/branches/soc2009/model-validation/django/forms/fields.py
2009-06-03 02:37:33 UTC (rev 10904)
+++ django/branches/soc2009/model-validation/django/forms/fields.py
2009-06-03 02:37:36 UTC (rev 10905)
@@ -314,12 +314,11 @@
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 @@
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 @@
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):
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---