core/migration/utils.py

11 lines
237 B
Python
Raw Permalink Normal View History

2022-08-11 09:14:12 +00:00
from datetime import datetime
from json import JSONEncoder
2022-09-03 10:50:14 +00:00
2022-08-11 09:14:12 +00:00
class DateTimeEncoder(JSONEncoder):
def default(self, z):
if isinstance(z, datetime):
2022-09-03 10:50:14 +00:00
return str(z)
2022-08-11 09:14:12 +00:00
else:
2022-09-03 10:50:14 +00:00
return super().default(z)