weekend_table.html 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. {% spaceless %}
  2. {% load django_tables2 %}
  3. {% load i18n %}
  4. {% if table.page %}
  5. <div class="table-container">
  6. {% endif %}
  7. {% block table %}
  8. <table{% if table.attrs %} {{ table.attrs.as_html }}{% endif %}>
  9. {% nospaceless %}
  10. {% block table.thead %}
  11. <thead>
  12. <tr>
  13. {% for column in table.columns %}
  14. {% if column.orderable %}
  15. <th {{ column.attrs.th.as_html }}><a href="{% querystring table.prefixed_order_by_field=column.order_by_alias.next %}">{{ column.header }}</a></th>
  16. {% else %}
  17. <th {{ column.attrs.th.as_html }}>{{ column.header }}</th>
  18. {% endif %}
  19. {% endfor %}
  20. </tr>
  21. </thead>
  22. {% endblock table.thead %}
  23. {% block table.tbody %}
  24. <tbody>
  25. {% for row in table.page.object_list|default:table.rows %} {# support pagination #}
  26. {% block table.tbody.row %}
  27. <tr class="
  28. {% if row.date.is_weekend %}weekend{% else %}
  29. {{ forloop.counter|divisibleby:2|yesno:"even,odd" }}{% endif %}
  30. "> {# avoid cycle for Django 1.2-1.6 compatibility #}
  31. {% for column, cell in row.items %}
  32. <td {{ column.attrs.td.as_html }}>{% if column.localize == None %}{{ cell }}{% else %}{% if column.localize %}{{ cell|localize }}{% else %}{{ cell|unlocalize }}{% endif %}{% endif %}</td>
  33. {% endfor %}
  34. </tr>
  35. {% endblock table.tbody.row %}
  36. {% empty %}
  37. {% if table.empty_text %}
  38. {% block table.tbody.empty_text %}
  39. <tr><td colspan="{{ table.columns|length }}">{{ table.empty_text }}</td></tr>
  40. {% endblock table.tbody.empty_text %}
  41. {% endif %}
  42. {% endfor %}
  43. </tbody>
  44. {% endblock table.tbody %}
  45. {% block table.tfoot %}
  46. <tfoot>
  47. {% if table.summary %}
  48. <tr>
  49. {% for summary in table.summary %}
  50. <td> {{ summary }} </td>
  51. {% endfor %}
  52. </tr>
  53. {% endif %}
  54. </tfoot>
  55. {% endblock table.tfoot %}
  56. {% endnospaceless %}
  57. </table>
  58. {% endblock table %}
  59. {% endspaceless %}