INSTEAD OF THIS for question in questions if question is_sub_questions

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
INSTEAD OF THIS
{% for question in questions %}
{% if question.is_sub_questions %}
{% for sub_question in question.sub_questions %}
{% crispy sub_question.form %}
{% endfor %}
{% elif question.is_match %}
<div class="match-question">
{% for match_question in question.match_question_list %}
{% crispy match_question.form %}
{% endfor %}
</div>
{% elif question.is_right_place %}
.........
{% endif %}
{% endfor %}
WILL BE THIS
{% for question_form in question_forms %}
{{ question_form }}
{# if we need access to question object we can do question_form.get_question() #}
{% endfor