Index: appengine_django/serializer/python.py =================================================================== --- appengine_django/serializer/python.py (revision 19) +++ appengine_django/serializer/python.py (working copy) @@ -22,6 +22,8 @@ entity and also recreate the keys for any references appropriately. """ +import datetime +import time from django.conf import settings from django.core.serializers import base @@ -34,7 +36,6 @@ try: from django.utils.encoding import smart_unicode except ImportError: - import datetime import types from django.utils.functional import Promise @@ -75,7 +76,10 @@ Serializer = python.Serializer +DATE_FORMAT = "%Y-%m-%d" +TIME_FORMAT = "%H:%M:%S" + class FakeParent(object): """Fake parent 'model' like object. @@ -121,8 +125,18 @@ if not data[field.name].name(): raise base.DeserializationError(u"Cannot load Reference with " "unnamed key: '%s'" % field_value) - else: - data[field.name] = field.validate(field_value) + continue + + if isinstance(field, db.DateTimeProperty): + try: + t = time.strptime(field_value, "%s %s"% (DATE_FORMAT, TIME_FORMAT)) + d = datetime.datetime(*(t)[0:6]) + field_value = d + except (ValueError, TypeError), e: + # Pass it on anyway, and hope the model can deal with it. + pass + + data[field.name] = field.validate(field_value) # Create the new model instance with all it's data, but no parent. object = Model(**data) # Now add the parent into the hidden attribute, bypassing the type checks