Skip to content

Commit

Permalink
include a way to dump timedeltafields so that it is possible to save …
Browse files Browse the repository at this point in the history
…data to fixtures

 - Legacy-Id: 5613
  • Loading branch information
mcr committed Apr 4, 2013
1 parent 23bdae3 commit 32cb1d8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions v4.43/django/core/serializers/json.py
Expand Up @@ -54,6 +54,8 @@ def default(self, o):
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)

Expand Down

0 comments on commit 32cb1d8

Please sign in to comment.