{% comment %} Table where each questiongroup occupies one row. The first column is filled with the label of the questiongroup. Further questions are rendered either before the table (questiongroup_config.layout == 'before_table') or after the table. {% endcomment %} {% load floppyforms %} {% load list_to_columns %} {% if config.next_level == 'subcategories' %}

{{ config.label }}

{% for sub_config, sub_formsets in formsets %} {% form form using sub_config.form_template with config=sub_config formsets=sub_formsets %} {% endfor %} {% else %}
{{ config.numbering|default:'' }} {{ config.label }} {% for questiongroup_config, questiongroup_formset in formsets %} {% if questiongroup_config.keyword not in config.table_grouping.0 and questiongroup_config.layout == 'before_table' %} {% include "form/helptext.html" with helptext=questiongroup_config.helptext helptext_length=questiongroup_config.helptext_length %} {% form form using "form/questiongroup/default.html" with config=questiongroup_config formset=questiongroup_formset %} {% endif %} {% endfor %} {% for questiongroup_config, questiongroup_formset in formsets %} {% if questiongroup_config.keyword in config.table_grouping.0 %} {% include "form/helptext.html" with helptext=questiongroup_config.helptext helptext_length=questiongroup_config.helptext_length %} {% endif %} {% endfor %} {% for header in config.table_headers %} {% endfor %} {% for questiongroup_config, questiongroup_formset in formsets %} {% if questiongroup_config.keyword in config.table_grouping.0 %} {{ questiongroup_formset.management_form }} {% for f in questiongroup_formset.forms %} {% if questiongroup_config.layout != 'no_label_row' %} {% endif %} {% for field in f.visible_fields %} {% endfor %} {% for field in f.hidden_fields %}{% formfield field %}{% endfor %} {% endfor %} {% endif %} {% endfor %}
{% with helptext=config.table_helptexts|get_by_index:forloop.counter0 %} {% if helptext %} {{ header }} {% else %} {{ header }} {% endif %} {% endwith %}
{{ questiongroup_config.label }} {% formrow field using "form/question/no_label.html" %}
{% for questiongroup_config, questiongroup_formset in formsets %} {% if questiongroup_config.keyword not in config.table_grouping.0 and questiongroup_config.layout != 'before_table' %} {% include "form/helptext.html" with helptext=questiongroup_config.helptext helptext_length=questiongroup_config.helptext_length %} {% form form using "form/questiongroup/default.html" with config=questiongroup_config formset=questiongroup_formset %} {% endif %} {% endfor %}
{% endif %}