Files
record/templates/asuzr/table_with_form.html
Denis V. Dedkov 4e041f8733 Кнопка сабмита
Сделал стиль как в админке
2015-08-25 10:24:30 +05:00

41 lines
1.5 KiB
HTML

{% extends "asuzr/totals_table.html" %}
{% load django_tables2 %}
{% load i18n %}
{% block table.tbody %}
<tbody>
{% for row in table.page.object_list|default:table.rows %} {# support pagination #}
{% block table.tbody.row %}
<tr class="{{ forloop.counter|divisibleby:2|yesno:"even,odd" }}"> {# avoid cycle for Django 1.2-1.6 compatibility #}
{% 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 %}
</tr>
{% endblock table.tbody.row %}
{% empty %}
{% if table.empty_text %}
{% block table.tbody.empty_text %}
<tr><td colspan="{{ table.columns|length }}">{{ table.empty_text }}</td></tr>
{% endblock table.tbody.empty_text %}
{% endif %}
{% endfor %}
{% if add_form %}
{% if params %}
<form action="{% url form_action params %}" method="POST" >
{% else %}
<form action="{% url form_action %}" method="POST" >
{% endif %}
{% csrf_token %}
<tr>
{% for field in add_form %}
<td>{{field}}</td>
{% endfor %}
</tr>
<tr>
<td class="align-right" colspan="{{ add_form.fields|length }}"><input type="submit" class="default" value="{{ add_form.submit_text }}"></td>
</tr>
</form>
{% endif %}
</tbody>
{% endblock table.tbody %}