Skip to content

Commit

Permalink
fix isinstance() with datetime.datetime
Browse files Browse the repository at this point in the history
  • Loading branch information
y2kconnect committed Oct 29, 2016
1 parent f105c30 commit 2ebfa4d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions xadmin/views/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,10 @@ def method(self, context, nodes, *arg, **kwargs):

class JSONEncoder(DjangoJSONEncoder):
def default(self, o):
if isinstance(o, datetime.date):
return o.strftime('%Y-%m-%d')
elif isinstance(o, datetime.datetime):
if isinstance(o, datetime.datetime):
return o.strftime('%Y-%m-%d %H:%M:%S')
elif isinstance(o, datetime.date):
return o.strftime('%Y-%m-%d')
elif isinstance(o, decimal.Decimal):
return str(o)
else:
Expand Down

0 comments on commit 2ebfa4d

Please sign in to comment.