1👍
It’s hard to tell given your broken indentation, but it seems your view will only return a 200 if it’s a POST request and the form is valid. Could it be that your form doesn’t validate ?
This being said, the recommended flow is to return a redirect to the result page on successful posts (google for “post redirect get”) to avoid double submissions on page reloading.
Totally unrelated but none of the statements in you try/expect block will raise an IndexError, and if Question
has a ForeignKey on Quizz
you should be able to retrieve questions directly with quizz.question_set.all()
.
Source:stackexchange.com