From c8477a0ba4266c8f5d1d5fbc06297600fd911378 Mon Sep 17 00:00:00 2001 From: "Denis V. Dedkov" Date: Sun, 14 Jun 2015 20:13:19 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=20=D1=88=D0=B0=D0=B1=D0=BB=D0=BE?= =?UTF-8?q?=D0=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Переименовал шаблон для таблицы с подкраской выходных дней --- asuzr/tables.py | 2 +- templates/asuzr/weekend_table.html | 77 ++++++++++++++++++++++++++++++ 2 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 templates/asuzr/weekend_table.html diff --git a/asuzr/tables.py b/asuzr/tables.py index 9525ffc..cad42c0 100644 --- a/asuzr/tables.py +++ b/asuzr/tables.py @@ -132,4 +132,4 @@ class VisitTable(tables.Table): class Meta: attrs = {'class': 'paleblue'} - template = 'asuzr/table_templ.html' + template = 'asuzr/weekend_table.html' diff --git a/templates/asuzr/weekend_table.html b/templates/asuzr/weekend_table.html new file mode 100644 index 0000000..e3d4c5d --- /dev/null +++ b/templates/asuzr/weekend_table.html @@ -0,0 +1,77 @@ +{% spaceless %} +{% load django_tables2 %} +{% load i18n %} +{% if table.page %} +
+{% endif %} +{% block table %} + + {% nospaceless %} + {% block table.thead %} + + + {% for column in table.columns %} + {% if column.orderable %} + {{ column.header }} + {% else %} + {{ column.header }} + {% endif %} + {% endfor %} + + + {% endblock table.thead %} + {% block table.tbody %} + + {% for row in table.page.object_list|default:table.rows %} {# support pagination #} + {% block table.tbody.row %} + {% if row.date.is_weekend %} + {# avoid cycle for Django 1.2-1.6 compatibility #} + {% else %} + {# avoid cycle for Django 1.2-1.6 compatibility #} + {% endif %} + {% for column, cell in row.items %} + {% if column.localize == None %}{{ cell }}{% else %}{% if column.localize %}{{ cell|localize }}{% else %}{{ cell|unlocalize }}{% endif %}{% endif %} + {% endfor %} + + {% endblock table.tbody.row %} + {% empty %} + {% if table.empty_text %} + {% block table.tbody.empty_text %} + {{ table.empty_text }} + {% endblock table.tbody.empty_text %} + {% endif %} + {% endfor %} + + {% endblock table.tbody %} + {% block table.tfoot %} + + {% endblock table.tfoot %} + {% endnospaceless %} + +{% endblock table %} + +{% if table.page %} +{% with table.page.paginator.count as total %} +{% with table.page.object_list|length as count %} +{% block pagination %} +
    + {% if table.page.has_previous %} + {% nospaceless %}{% block pagination.previous %}{% endblock pagination.previous %}{% endnospaceless %} + {% endif %} + + {% if table.page.has_previous or table.page.has_next %} + {% nospaceless %}{% block pagination.current %}
  • {% blocktrans with table.page.number as current and table.paginator.num_pages as total %}Page {{ current }} of {{ total }}{% endblocktrans %}
  • {% endblock pagination.current %}{% endnospaceless %} + {% endif %} + + {% if table.page.has_next %} + {% nospaceless %}{% block pagination.next %}{% endblock pagination.next %}{% endnospaceless %} + {% endif %} + + {% nospaceless %}{% block pagination.cardinality %}
  • {% if total != count %}{% blocktrans %}{{ count }} of {{ total }}{% endblocktrans %}{% else %}{{ total }}{% endif %} {% if total == 1 %}{{ table.data.verbose_name }}{% else %}{{ table.data.verbose_name_plural }}{% endif %}
  • {% endblock pagination.cardinality %}{% endnospaceless %} +
+{% endblock pagination %} +{% endwith %} +{% endwith %} +
+{% endif %} +{% endspaceless %}