toastdriven/django-tastypie — pull request #455 by pelme (2012-04-20 07:29:10+00:00)
Title: Raise ApiFieldError on invalid datetimes

Currently, invalid datetimes are allowed to pass through `DateTimeField.hydrate()` without any indication on errors.

When strings like `'foo'` are hydrated in a DateTimeField, the string value is returned without any errors raised, even though it is not a valid datetime.

If someone (accidentally or maliciously) passes in a list, an AttributeError from deep within `dateutil.parser.parse()` is raised.

This change makes sure that what comes out of `hydrate()` for a `DateTimeField` is indeed a `datetime.datetime` object, otherwise an error is raised.