2👍
✅
This is the line throwing the error:
selected_choice = Question.choice_set.get(pk=request.POST['choice'])
Basically, you need to call choice_set
on an instance of the Question model, not on the model itself.
So something like this might work:
question = Question.objects.get(pk=question_id)
selected_choice = question.choice_set.get(pk=request.POST['choice'])
Source:stackexchange.com