Merged [5613] from mcr@sandelman.ca: include a way to dump timedeltafields so that it is possible to save data to fixtures.
- Legacy-Id: 5785 Note: SVN reference [5613] has been migrated to Git commit 32cb1d83e78d890cc286fb47131489a74dda4b21
This commit is contained in:
parent
8330afa082
commit
ec2550db84
|
@ -54,6 +54,8 @@ class DjangoJSONEncoder(simplejson.JSONEncoder):
|
|||
return o.strftime(self.TIME_FORMAT)
|
||||
elif isinstance(o, decimal.Decimal):
|
||||
return str(o)
|
||||
elif isinstance(o, datetime.timedelta):
|
||||
return o.days * 24*60*60 + o.seconds
|
||||
else:
|
||||
return super(DjangoJSONEncoder, self).default(o)
|
||||
|
||||
|
|
Loading…
Reference in a new issue