3
我得到'YesNo' object is not iterable
。 ..apps/wadofstuff/django/serializers/base.py in serialize, line 44
'MyModel'對象不可迭代
def yes_add(request, id):
if request.is_ajax:
form = YesNoForm(request.POST)
if form.is_valid():
content = form.cleaned_data['content']
user = request.user
value = 'yes'
item = Item.objects.get(id=id)
yes = YesNo(value=value, user=user, item=item, content=content)
yes.save()
response = HttpResponse()
response['Content-Type'] = "text/javascript"
response.write(serializers.serialize("json", yes))
return response
但我用這樣的事情,但包含我的模型之一的幾個實例查詢集。有人有任何提示嗎?
而且一切都很好。謝謝。 – krzyhub