0
queryset = Status.objects.all()[:10]
Status
모델
commentAmount
가
commentAmount
필드를 가지고 있지 않아서 모든 개체에 추가 할 수 있습니다.
동적으로 생성 된 새로운 필드로 모델 객체를 업데이트 하시겠습니까?
for s in queryset:
s.commentAmount = s.getCommentAmount()
모두 괜찮습니다, print s.commentAmount
은 좋은 결과를 보여줍니다. :
response = HttpResponse()
response['Content-Type'] = "text/javascript"
response.write(serializers.serialize("json", queryset))
return response
JSON 파일을 반환 할 때 commentAmount
필드가 없습니다. 내 실수는 어디 갔지?