From bbb6f14d62d0f7f45e8890732ccf0260e01c2f7d Mon Sep 17 00:00:00 2001 From: Bradley Ayers Date: Sun, 10 Jul 2011 17:13:52 +1000 Subject: [PATCH] Fixed issue #14 (misleading custom template docs). --- docs/index.rst | 46 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 37 insertions(+), 9 deletions(-) diff --git a/docs/index.rst b/docs/index.rst index 7d5d33a..865ca60 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -500,29 +500,57 @@ ignore the built-in generation tools, and instead pass an instance of your .. code-block:: django + {% spaceless %} {% load django_tables2 %} - + {% if table.page %} +
+ {% endif %} +
- + {% for column in table.columns %} - + {% if column.sortable %} + {% with column.order_by as ob %} + + {% endwith %} + {% else %} + + {% endif %} {% endfor %} - {% for row in table.rows %} - + {% for row in table.page.object_list|default:table.rows %} {# support pagination #} + {% for cell in row %} - + {% endfor %} {% empty %} - {% if table.empty_text %} - - {% endif %} + {% if table.empty_text %} + + {% endif %} {% endfor %}
{{ column }}{{ column.header }}{{ column.header }}
{{ cell }}{{ cell }}
{{ table.empty_text }}
{{ table.empty_text }}
+ {% if table.page %} + + + {% endif %} + {% endspaceless %} + +.. note:: + + This is a complicated example, and is actually the template code that + ``{% render_table %}`` uses. .. _template_tags: -- 2.26.2