{% load i18n persons_tags %}{% load get_by_index sub from creme_core_tags %} {% persons_addresses_formblock_fields form=form address_fks=form_block.template_context.address_fields zip_fields=False as fields_info %} {% if fields_info %} {% with meta=fields_info.grouped_meta grouped_fields=fields_info.grouped_fields %} {% with count=meta|length %}
{% if count == 1 %}{{fields_info.grouped_meta.0.title}}{% else %}{% translate 'Addresses' %}{% endif %}
{% if count > 1 %}
{% for meta in fields_info.grouped_meta %}
{{meta.title}}
{% endfor %}
{% for meta in fields_info.grouped_meta %}
{% if not forloop.first %} {% with previous_idx=forloop.counter0|sub:1 %} {% with previous_meta=fields_info.grouped_meta|get_by_index:previous_idx %} {% endwith %} {% endwith %} {% endif %} {% if not forloop.last %} {% with next_meta=fields_info.grouped_meta|get_by_index:forloop.counter %} {% endwith %} {% endif %}
{% endfor %}
{% endif %}
{% for fields in grouped_fields %}
{% for field in fields %}
{% if field.help_text %}
{{field.help_text|linebreaksbr}}
{% endif %} {{field.errors}} {{field}}
{% endfor %}
{% endfor %}
{% endwith %}{% endwith %} {% endif %}