1👍
✅
Rather than using a set here, I would use a dictionary keyed by the question ID. (Note you don’t actually need the question itself, so you can drop the select_related.)
choice_dict = {c.question_id: c for c in Choice.objects.filter(question__in=questions).all()}
for question in questions:
Answer(question=question,
choice=choice_dict[question.id],
response=response)
Source:stackexchange.com