0

以下では、クエリを取得しようとしていますが、make は json オブジェクトであるため、jQuery を使用するテンプレートでループできます。

私の見解

from django.core import serializers
objectQuerySet = Recipient.objects.filter(incentiveid=incentive).values("mobile", "countryid")
data = serializers.serialize("json", objectQuerySet)

return render_to_response('smssend.html', context_instance=RequestContext(リクエスト))

次のエラーが表示されます。

Non-model object (<type 'dict'>) encountered during serialization

Request Method: 

なぜ?

4

1 に答える 1

2

#values() 「反復可能として使用すると辞書を返します」 - https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.values

ここに python の json#dumps(dict) が必要だと思います

于 2013-01-14T11:22:23.403 に答える