From: Bradley Ayers Date: Sun, 10 Jul 2011 07:13:52 +0000 (+1000) Subject: Fixed issue #14 (misleading custom template docs). X-Git-Tag: v0.7.0~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=bbb6f14d62d0f7f45e8890732ccf0260e01c2f7d;p=django-tables2.git Fixed issue #14 (misleading custom template docs). --- 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: