Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

DateTimeField can now clean values that come from SplitDateTimeWidget.

git-svn-id: bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit f5831b03c908d9d4bf59f0a0cef4e3db221367ca 1 parent d79c6a0
@malcolmt malcolmt authored
Showing with 6 additions and 0 deletions.
  1. +6 −0 django/newforms/
6 django/newforms/
@@ -300,6 +300,12 @@ def clean(self, value):
return value
if isinstance(value,
return datetime.datetime(value.year, value.month,
+ if isinstance(value, list):
+ # Input comes from a SplitDateTimeWidget, for example. So, it's two
+ # components: date and time.
+ if len(value) != 2:
+ raise ValidationError(ugettext(u'Enter a valid date/time.'))
+ value = '%s %s' % tuple(value)
for format in self.input_formats:
return datetime.datetime(*time.strptime(value, format)[:6])
Please sign in to comment.
Something went wrong with that request. Please try again.