{% extends "django_tables2/table.html" %}

{% load django_tables2 %}

{% block table.thead %}
<thead>
    <tr>
    {% for column in table.columns %}
        {% if column.orderable %}
        <th {{ column.attrs.th.as_html }}><a href="{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}">{{ column.header }}</a></th>
        {% else %}
        <th {{ column.attrs.th.as_html }}>{{ column.header }}</th>
        {% endif %}
    {% endfor %}
    {% block table.head.last.column %}
    {% endblock %}
    </tr>
</thead>
{% endblock table.thead %}

{% block table.tbody.row %}
<tr 
     {% if table.context.row_link %}
       {% if popup_edit %}
         rel="popup"
       {% endif %}
       {% if table.context.url_name %}
         data-url="{% url table.context.url_name pk=row.record.pk %}"
       {% else %}
         data-url="{{ row.record.pk }}/"
       {% endif %}
     {% endif %}
     data-pk="{{ row.record.id }}"
     class="{{ forloop.counter|divisibleby:2|yesno:"even,odd" }}"> 
            {% for column, cell in row.items %}
                <td {{ column.attrs.td.as_html }}>{% if column.localize == None %}{{ cell }}{% else %}{% if column.localize %}{{ cell|localize }}{% else %}{{ cell|unlocalize }}{% endif %}{% endif %}</td>
            {% endfor %}
            {% block table.tbody.last.column %}
            {% endblock %}
        </tr>
{% endblock table.tbody.row %}

{% block pagination %}
  {% with page_obj=table.page page_key=table.prefixed_page_field %}
    {% include "gadjo/pagination.html" %}
  {% endwith %}
{% endblock %}
