{% load i18n pagination_tags %}

{% load djangoplus_tags %}

{% if driver.search_fields or driver.list_filter %}
<div class="ajax-fk-filter">
    {% if driver.search_fields %}
    Palavra-chave: <input type="text" id="ajax-fk-search" name='ajax_fk_search' value="{{ request.GET.ajax_fk_search }}"/>&nbsp;
    {% endif %}

    <input type="button" value="{% trans "Procurar" %}" class="ajax-fk-search"/>
</div>
{% endif %}

<div class="ajax-fk-buttons">
    <a class="ajax-fk-close" href="javascript: void(0)">Fechar</a>
</div>

{% autopaginate results 10 %}

{% paginate %}

<div class="module">
    <table class="ajax-fk-results" cellspacing="0">
        <thead>
            <tr>
                {% for col in columns %}
                <th class="{{ col.name }}">{{ col }}</th>
                {% endfor %}
            </tr>
        </thead>

        <tbody>
            {% for obj in results %}
            <tr>
                <input type="hidden" value="{{ obj.pk }}" id="ajax-fk-result-pk"/>
                <input type="hidden" value="{{ obj }}" id="ajax-fk-result-display"/>
                <input type="hidden" value="{{ obj|ajaxfkwidget_url:function_get_url }}" id="ajax-fk-result-url"/>

                {% ajaxfkwidget_cells obj list_display cells %}

                {% for cell in cells %}
                <td class="{{ cell.name }}">{{ cell.value }}</td>
                {% endfor %}
            </tr>
            {% endfor %}
        <tbody>
    </table>
</div>

{% paginate %}

