モデルの json を表示する必要があります。
product = list(product.objects.all().values('title', 'date'))
return HttpResponse(simplejson.dumps(product))
私の問題は日付にあります。エラーメッセージは次のとおりです:datetime.datetime(...., tzinfo=) is not JSON serializable
私は次のように示す必要があります:
[
{
title : 'product 1',
date : '2013-06-01'
},
{
title : 'product 2',
date : '2013-06-05',
}
]
いくつかの提案?また、json でフィールドの順序を定義するにはどうすればよいですか。ej: (タイトル、日付) または (日付、タイトル)
ありがとう