I have Queryset:
queryset = Status.objects.all()[:10]
Model Status
hasn't got field commentAmount
so I would add it to every object in Queryset:
for s in queryset:
s.commentAmount = s.getCommentAmount()
All is fine, print s.commentAmount
shows good results, but after:
response = HttpResponse()
response['Content-Type'] = "text/javascript"
response.write(serializers.serialize("json", queryset))
return response
I have not field commentAmount
in returning JSON file. Where is my mistake?