{% load suit_tags %}
{% with singlefield=line.fields|length_is:'1' %}
{% for field in line %}{#% spaceless %#}{% if not field.field.is_hidden %}
{# write special control tags only for first multi field #}
{% if forloop.first %}
{# if multi-fields and first field #}
{% if not singlefield %}
{% endif %}
{% else %}
{# If multi-fields and not first wrap also label #}
{% if not singlefield and not forloop.first %}
{% endif %}
{% endif %}
{% if not field.is_readonly and field.errors %}
{% endif %}
{# if multi-fields and wrap controls too #}
{% if not singlefield %}
{% endif %}
{% if field.is_readonly %}
{{ field|field_contents_foreign_linked|linebreaksbr }}
{% else %}
{{ field.field }}
{% endif %}
{# For single field errors#}
{% if singlefield and line.errors %}
{{ line.errors }}
{% endif %}
{# For multi field errors #}
{% if field.errors and not singlefield and not field.is_readonly %}
{{ field.errors|striptags }}
{% endif %}
{% if field.field.help_text %}
{{ field.field.help_text|safe }}
{% endif %}
{% if not field.is_readonly and field.errors %}
{% endif %}
{% if not singlefield %}
{# close multi-field-controls #}
{# close multi-field-box #}
{% endif %}
{% if forloop.last %}