私は以下を持っています:
answers = Answer.objects.filter(id__in=[answer.id for answer in answer_set.answers.all()])
じゃあ後で:
for i in range(len(answers)):
# iterate through all existing QuestionAnswer objects
for existing_question_answer in existing_question_answers:
# if an answer is already associated, remove it from the
# list of answers to save
if answers[i].id == existing_question_answer.answer.id:
answers.remove(answers[i]) # doesn't work
existing_question_answers.remove(existing_question_answer)
エラーが発生します:
'QuerySet' object has no attribute 'remove'
QuerySetを標準セットまたはリストに変換するためにあらゆる種類のことを試しました。何も機能しません。
QuerySetから項目を削除して、データベースから削除せず、新しいQuerySetを返さないようにするにはどうすればよいですか(機能しないループにあるため)。