{% load i18n %}
{% load cradmin_icon_tags %}

<div id="id_cradmin_modelchoicefieldwrapper_{{ fieldname }}"
        django-cradmin-model-choice-field-wrapper="{{ selectview_url }}"
        class="django-cradmin-modelchoicefield-wrapper">

    {% block input %}
        <input type="{{ rendered_input_type }}" value="{{ fieldvalue }}"
               id="{{ fieldid }}" name="{{ fieldname }}"
               django-cradmin-model-choice-field-input>
    {% endblock input %}

    {% block preview %}
        <div django-cradmin-model-choice-field-preview class="django-cradmin-modelchoicefield-preview">
            {% if preview %}
                {{ preview|safe }}
            {% endif %}
        </div>
    {% endblock preview %}

    {% block selectbutton %}
        <button class="btn btn-default" type="button"
                django-cradmin-model-choice-field-changebegin-button>
            {% trans "Select ..." %}
        </button>
    {% endblock selectbutton %}
</div>
