{% if fieldsets %}
    {% for fieldset in fieldsets %}
      {% include "report_builder/fieldsets.html" with fieldset=fieldset %}
    {% endfor %}
{% else %}
    <ul>
    {% for field in fields %}
      {% include "report_builder/fieldset.html" with verbose_name_extra=field.get_internal_type %}
    {% endfor %}
    </ul>
{% endif %}

{% if custom_fields %}
    <h4>Custom Fields</h4>
    <ul>
        {% for custom_field in custom_fields %}
            {% include "report_builder/fieldset.html" with field=custom_field verbose_name_extra=custom_field.get_field_type_display verbose_name=custom_field.name custom=True %}
        {% endfor %}
    </ul>
{% endif %}

{% if properties %}
    <h4>Properties</h4>
    <ul>
        {% for property in properties %}
            {% if forloop.first %}
            {% endif %}
            {% include "report_builder/fieldset.html" with field=property verbose_name_extra='property' verbose_name=property.label %}
        {% endfor %}
    </ul>
{% endif %}
