Skip to content

Instantly share code, notes, and snippets.

from django.db import models
from django.utils import simplejson as json
from django.conf import settings
from datetime import datetime
class JSONEncoder(json.JSONEncoder):
def default(self, obj):
if isinstance(obj, datetime):
return obj.strftime('%Y-%m-%d %H:%M:%S')