{% extends "beam/base.html" %}
{% load i18n %}
{% load beam_tags %}

{% block heading %}
    <h1>{{ object }}</h1>
{% endblock %}

{% block content %}
    <div class="card">
        <div class="card-body">
            <dl class="row">
                {% for field_name in viewset_context.fields %}
                    <dt class="col-sm-4 col-md-3 col-lg-2">
                        {{ field_name }}
                    </dt>
                    <dd class="col-sm-8 col-md-9 col-lg-10">
                        {% get_attribute object field_name as value %}
                        {% if value|is_image %}
                            {% if value %}
                                <img class="img-fluid" src="{{ value.url }}"/>
                            {% else %}
                                -
                            {% endif %}
                        {% elif value|is_file %}
                            {% if value %}
                                <a href="{{ value.url }}">{% trans "Download" %}</a>
                            {% else %}
                                -
                            {% endif %}
                        {% else %}
                            {{ value }}
                        {% endif %}
                    </dd>
                {% endfor %}
            </dl>
        </div>
    </div>
{% endblock %}
