Column

Class that describes a column, i.e. the text of the header, how to get and display the data in the cell, etc.

Refinable members

  • after
  • attr
    What attribute to use, defaults to same as name. Follows django conventions to access properties of properties, so “foo__bar” is equivalent to the python code foo.bar. This parameter is based on the variable name of the Column if you use the declarative style of creating tables.
  • auto_rowspan
    enable automatic rowspan for this column. To join two cells with rowspan, just set this auto_rowspan to True and make those two cells output the same text and we’ll handle the rest.
  • bulk
  • cell
  • choices
  • data_retrieval_method
  • display_name
    the text of the header for this column. By default this is based on the name parameter so normally you won’t need to specify it.
  • extra
  • group
    string describing the group of the header. If this parameter is used the header of the table now has two rows. Consecutive identical groups on the first level of the header are joined in a nice way.
  • header
  • model
  • model_field
  • name
    the name of the column
  • query
  • show
    set this to False to hide the column
  • sort_default_desc
    Set to True to make table sort link to sort descending first.
  • sort_key
    string denoting what value to use as sort key when this column is selected for sorting. (Or callable when rendering a table from list.)
  • sortable
    set this to False to disable sorting on this column
  • superheader
  • url
    URL of the header. This should only be used if “sorting” is off.

Defaults

  • auto_rowspan
    • False
  • bulk__show
    • False
  • cell__format
    • tri_table.default_cell_formatter
  • cell__template
    • None
  • cell__url
    • None
  • cell__url_title
    • None
  • cell__value
    • lambda table, column, row, **_: getattr_path(row, evaluate(column.attr, table=table, column=column))
  • data_retrieval_method
    • DataRetrievalMethods.attribute_access
  • header__attrs__class__ascending
    • lambda bound_column, **_: bound_column.sort_direction == ASCENDING
  • header__attrs__class__descending
    • lambda bound_column, **_: bound_column.sort_direction == DESCENDING
  • header__attrs__class__first_column
    • lambda header, **_: header.index_in_group == 0
  • header__attrs__class__sorted_column
    • lambda bound_column, **_: bound_column.is_sorting
  • header__attrs__class__subheader
    • True
  • header__template
    • tri_table/header.html
  • query__show
    • False
  • show
    • True
  • sort_default_desc
    • False
  • sortable
    • True

Shortcuts

boolean

Shortcut to render booleans as a check mark if true or blank if false.

boolean_tristate

choice

choice_queryset

date

datetime

decimal

delete

Shortcut for creating a clickable delete icon. The URL defaults to your_object.get_absolute_url() + ‘delete/’. Specify the option cell__url to override.

download

Shortcut for creating a clickable download icon. The URL defaults to your_object.get_absolute_url() + ‘download/’. Specify the option cell__url to override.

edit

Shortcut for creating a clickable edit icon. The URL defaults to your_object.get_absolute_url() + ‘edit/’. Specify the option cell__url to override.

email

float

foreign_key

icon

Shortcut to create font awesome-style icons.

param icon:the font awesome name of the icon

integer

many_to_many

multi_choice

multi_choice_queryset

number

run

Shortcut for creating a clickable run icon. The URL defaults to your_object.get_absolute_url() + ‘run/’. Specify the option cell__url to override.

select

Shortcut for a column of checkboxes to select rows. This is useful for implementing bulk operations.

param checkbox_name:
 the name of the checkbox. Default is “pk”, resulting in checkboxes like “pk_1234”.
param checked:callable to specify if the checkbox should be checked initially. Defaults to False.

substring

text

time