{% 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 %}
{% if config.label_position != 'none' %} {{ config.numbering|default:'' }} {{ config.label }} {% endif %} {% include "form/helptext.html" with helptext=config.helptext helptext_length=config.helptext_length %} {% for questiongroup_config, questiongroup_formset in formsets %} {% if questiongroup_config.keyword not in config.table_grouping.0 and questiongroup_config.layout == 'before_table' %} {% form form using questiongroup_config.template with config=questiongroup_config formset=questiongroup_formset %} {% endif %} {% endfor %} {% for header in config.table_headers %} {% if not forloop.last %} {% with helptext=config.table_helptexts|get_by_index:forloop.counter0 %} {% if helptext %} {{ header }} {% else %} {{ header }} {% if forloop.counter == 4 or forloop.counter == 5 %} () {% endif %} {% endif %} {% endwith %} {% endif %} {% 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' %} {% if forloop.first %} {% endif %} {% endif %} {% for field in f.visible_fields %} {% endfor %} {% for field in f.hidden_fields %}{% formfield field %}{% endfor %} {% endfor %} {% elif questiongroup_config.keyword in config.table_grouping.1 %} {{ questiongroup_formset.management_form }} {% for f in questiongroup_formset.forms %} {% for field in f.visible_fields %} {% endfor %} {% for field in f.hidden_fields %}{% formfield field %}{% endfor %} {% endfor %} {% endif %} {% endfor %}
{% if questiongroup_config.helptext %} {{ questiongroup_config.label }} {% else %} {{ questiongroup_config.label }} {% endif %} {% formrow field using "form/question/no_label.html" %}
{{ field.label }}{% if forloop.parentloop.parentloop.counter == 8 %} (){% endif %} {% 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.keyword not in config.table_grouping.1 and questiongroup_config.layout != 'before_table' %} {% form form using questiongroup_config.template with config=questiongroup_config formset=questiongroup_formset %} {% endif %} {% endfor %}
{% endif %}