{% load static %}
{% load i18n %}

<!-- from INSTANCE LIST (mulitple  objects) -->

{% if item.dataformat == "string" %}  
<div class="d-flex justify-content-left">
   {% if item.dataformat_ext == "safe" %} {{ item.value|safe }}
   {% else %} {{ item.value|default:'' }} {% endif %}
</div>

{% elif item.dataformat == "boolean" %}  
<div class="d-flex justify-content-center">
{% if item.value %}<i class="fa fa-check" aria-hidden="true"></i>{% endif %}
</div>

{% elif item.dataformat == "int" %}  
<div class="d-flex flex-wrap justify-content-end">
    {{ item.value|default:'' }}
</div>
{% elif item.dataformat == "float" %}
<div class="d-flex flex-wrap justify-content-end">
    {{ item.value|default:'' }}
</div>

{% elif item.dataformat == "group" %}  
    <div class="d-flex flex-wrap justify-content-left">
        {% for z in item.value %} {{ z.key }} ({{ z.display }}){% if not forloop.last %}, {% endif %}{% endfor %}
    </div>   

{% elif item.dataformat == "role" %}  
    <div class="d-flex flex-wrap justify-content-left">
        {% for z in item.value %} {{ z.key }} ({{ z.display }}){% if not forloop.last %}, {% endif %}{% endfor %}
    </div>  

{% elif item.dataformat == "user" %}
    <div class="d-flex flex-wrap justify-content-left"> 
    {% for z in item.value %}{{ z.key }} ({{ z.display }}){% if not forloop.last %}, {% endif %}{% endfor %}     
    </div>  

{% elif item.dataformat == "schema" %}  
    <div class="d-flex flex-wrap justify-content-left">
        {% for z in item.value %} {{ z.display|default:z.key }}{% if not forloop.last %}, {% endif %}{% endfor %} 
    </div>          

{% elif item.dataformat == "enumerate" %}  
    <div class="d-flex flex-wrap justify-content-left">
        {% for z in item.value %} {{ z.widget|safe }} {{ z.value|default:'' }} {{ z.detail }} <br> {% endfor %}
    </div>

{% elif item.dataformat == "external" %}  
    <div class="d-flex flex-wrap justify-content-left"> 
        {{ item.value|default:'' }}
    </div>  

{% elif item.dataformat == "text" %} 
    {% if item.dataformat_ext == "html" %}
        <div>{{ item.value|truncatechars:64|default:''|safe }}</div>
    {% else %}
        <pre>{{ item.value|truncatechars:64|default:'' }}</pre> 
    {% endif %}


{% elif item.dataformat == "file" %}  
<div class="d-flex flex-wrap"> 
    {% if item.queryset.0.displayname %}
    <a href="{% url 'app_data:file_display' item.queryset.0.fileid %}">
        <i class="fa fa-file me-2"></i>
        {{ item.queryset.0.displayname }} ({{ item.queryset.0.size}})
    </a>
    {% endif %}
</div>

{% elif item.dataformat == "password" %}  
<div class="d-flex justify-content-left">
   {{ item.value.0|default:'' }}
</div>

{% elif item.dataformat == "permission" %}  
    <div class="d-flex flex-wrap">
        {% for z in item.value %}{{ z.key }}<br>{% endfor %}
    </div> 

{% else %} {{ item.value|default:'' }}  {% endif %}
