既存のコメントを編集しようとしています (つまり、古いコメントを新しいコメントに置き換えます)。私のコメント アプリは 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'