diff --git a/ox/django/fields.py b/ox/django/fields.py index 006fcf7..7d110c1 100644 --- a/ox/django/fields.py +++ b/ox/django/fields.py @@ -12,10 +12,10 @@ from ox.utils import json def to_json(python_object): if isinstance(python_object, datetime.datetime): if python_object.year < 1900: - tt = python_ojbect.timetuple() + tt = python_object.timetuple() value = '%d-%02d-%02dT%02d:%02d%02dZ' % tuple(list(tt)[:6]) else: - value = python_ojbect.strftime('%Y-%m-%dT%H:%M:%SZ') + value = python_object.strftime('%Y-%m-%dT%H:%M:%SZ') return {'__class__': 'datetime.datetime', '__value__': value} if isinstance(python_object, datetime_safe.datetime): diff --git a/ox/django/shortcuts.py b/ox/django/shortcuts.py index 862568a..0691159 100644 --- a/ox/django/shortcuts.py +++ b/ox/django/shortcuts.py @@ -21,9 +21,9 @@ def json_response(data=None, status=200, text='ok'): def _to_json(python_object): if isinstance(python_object, datetime.datetime): if python_object.year < 1900: - tt = python_ojbect.timetuple() + tt = python_object.timetuple() return '%d-%02d-%02dT%02d:%02d%02dZ' % tuple(list(tt)[:6]) - return python_ojbect.strftime('%Y-%m-%dT%H:%M:%SZ') + return python_object.strftime('%Y-%m-%dT%H:%M:%SZ') if isinstance(python_object, datetime_safe.datetime): return python_object.strftime('%Y-%m-%dT%H:%M:%SZ') raise TypeError(u'%s %s is not JSON serializable' % (repr(python_object), type(python_object)))