我正在尝试编辑现有评论(即用新评论替换旧评论)。我的评论应用是 django.contrib.comments。
new_comment = form.cleaned_data['comment']
#all of the comments for this particular review
comments = Comment.objects.for_model(Review).filter(object_pk=review_id)
print comments[0].comment
#'old comment'
comments[0].comment = new_comment
print comments[0].comment
#'old comment' is still printed
为什么评论没有被新评论更新?
谢谢你。
编辑:调用comments[0].save()
然后print comments[0].comment
,仍然打印'old comment'