django 序列化json问题

from django.core import serializers

@login_required
def ajax_get_data(request):
    json_data = serializers.serialize("json", MyModel.objects.all())
    return HttpResponse(json_data,content_type="application/json")
objectQuerySet = ConventionCard.objects.filter(ownerUser = user)
data = serializers.serialize('json', list(objectQuerySet), fields=('fileName','id'))

 

posted @ 2015-03-13 15:44  梦的怒放ing  阅读(296)  评论(0编辑  收藏  举报