File: swapping-columns.rst

package info (click to toggle)
django-tables 2.7.5-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,752 kB
  • sloc: python: 7,120; makefile: 132; sh: 74
file content (21 lines) | stat: -rw-r--r-- 776 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
.. _swapping-columns:

Swapping the position of columns
================================

By default columns are positioned in the same order as they are declared,
however when mixing auto-generated columns (via `Table.Meta.model`) with
manually declared columns, the column sequence becomes ambiguous.

To resolve the ambiguity, columns sequence can be declared via the
`.Table.Meta.sequence` option::

    class PersonTable(tables.Table):
        selection = tables.CheckBoxColumn(accessor="pk", orderable=False)

        class Meta:
            model = Person
            sequence = ('selection', 'first_name', 'last_name')

The special value ``'...'`` can be used to indicate that any omitted columns
should inserted at that location. As such it can be used at most once.