Table
=====
Base class: :doc:`Part`
Describe a table. Example:
.. code-block:: python
class AlbumTable(Table):
name = Column()
artist = Column()
class Meta:
sortable = False
.. raw:: html
▼ Hide result
Toggle structure
Refinable members
-----------------
`action_class`
^^^^^^^^^^^^^^
Type: `type[Action]`
`actions`
^^^^^^^^^
Type: `dict[str, Action]`
Cookbook:
:ref:`custom-actions`
`actions_below` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: `bool`
Default: `False`
`actions_template` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: `str | Template`
Default: `iommi/form/actions.html`
`after` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: `int | str`
See :ref:`after `
`assets`
^^^^^^^^
Type: `Namespace`
See :ref:`assets `
`attrs` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
dict of strings to string/callable of HTML attributes to apply to the table
Type: :doc:`Attrs`
See :ref:`attributes `
Cookbook:
:ref:`freetext-column`
`auto`
^^^^^^
Type: :doc:`TableAutoConfig`
See :ref:`auto `
Cookbook:
:ref:`fk-related-data-access`
:ref:`nested-fk`
`bulk` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: `Form | None`
Cookbook:
:ref:`bulk-delete`
:ref:`custom-bulk-action`
`bulk_container`
^^^^^^^^^^^^^^^^
Type: :doc:`Fragment`
`bulk_exclude` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
exclude filters to apply to the `QuerySet` before performing the bulk operation
Type: `Namespace`
Default: `{}`
`bulk_filter` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
filters to apply to the `QuerySet` before performing the bulk operation
Type: `Namespace`
Default: `{}`
`cell` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: `CellConfig`
Cookbook:
:ref:`table-as-div`
`cells_class`
^^^^^^^^^^^^^
Type: `type[Cells]`
`columns`
^^^^^^^^^
(use this only when not using the declarative style) a list of Column objects
Type: `dict[str, Column]`
Cookbook:
:ref:`cell-link`
:ref:`column-computed-data`
:ref:`reorder-columns`
`container` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: :doc:`Fragment`
Cookbook:
:ref:`arbitrary-html`
`default_sort_order`
^^^^^^^^^^^^^^^^^^^^
Type: `str`
Cookbook:
:ref:`default-sort-order`
`empty_message` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: `str`
Cookbook:
:ref:`table-as-div`
`endpoints`
^^^^^^^^^^^
Type: `Namespace`
See :ref:`endpoints `
`extra`
^^^^^^^
Type: `dict[str, Any]`
See :ref:`extra `
`extra_evaluated`
^^^^^^^^^^^^^^^^^
Type: `dict[str, Any]`
See :ref:`extra `
`extra_params`
^^^^^^^^^^^^^^
See :ref:`extra_params `
`form_class`
^^^^^^^^^^^^
Type: `type[Form]`
`h_tag` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: `Fragment | str`
See :ref:`title `
`header`
^^^^^^^^
Default: `Namespace()`
Cookbook:
:ref:`turn-off-header`
:ref:`stop-header-render`
:ref:`table-as-div`
`include` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: `bool`
See :ref:`include `
`invalid_form_message` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: `str`
`iommi_style`
^^^^^^^^^^^^^
Type: `str | Style | None`
See :ref:`iommi_style `
`member_class`
^^^^^^^^^^^^^^
Type: `type[Column]`
`model` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: `type[Model] | None`
`outer` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: :doc:`Fragment`
Cookbook:
:ref:`arbitrary-html`
`page_class`
^^^^^^^^^^^^
Type: `type[Page]`
`page_size` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: `int`
Default: `16`
Cookbook:
:ref:`turn-off-pagination`
`parts`
^^^^^^^
Type: `Namespace`
`post_bulk_edit`
^^^^^^^^^^^^^^^^
`preprocess_row`
^^^^^^^^^^^^^^^^
Cookbook:
:ref:`table-as-div`
`preprocess_rows`
^^^^^^^^^^^^^^^^^
Cookbook:
:ref:`table-as-div`
`query`
^^^^^^^
Type: `Query | None`
Cookbook:
:ref:`initial-filter`
`query_class`
^^^^^^^^^^^^^
Type: `type[Query]`
`query_from_indexes`
^^^^^^^^^^^^^^^^^^^^
Type: `bool`
Cookbook:
:ref:`query-from-indexes`
`row` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: `RowConfig`
Cookbook:
:ref:`customize-rendering-row`
`row_group_class`
^^^^^^^^^^^^^^^^^
Type: `type[RowGroup]`
`rows` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
a list or QuerySet of objects
Cookbook:
:ref:`additional-rows`
`sortable` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
set this to `False` to turn off sorting for all columns
Type: `bool`
Default: `True`
Cookbook:
:ref:`table-sorting`
`sorter`
^^^^^^^^
`superheader`
^^^^^^^^^^^^^
Type: `Namespace`
`table_tag_wrapper` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: :doc:`Fragment`
`tag` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: `str`
Default: `table`
See :ref:`tag `
Cookbook:
:ref:`table-as-div`
`tbody` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: :doc:`Fragment`
Cookbook:
:ref:`table-as-div`
`template` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: `str | Template`
Default: `iommi/table/table.html`
See :ref:`template `
`title` (:ref:`evaluated `)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Type: `str | None`
See :ref:`title `
Shortcuts
---------
`Table.div`
^^^^^^^^^^^
Defaults
++++++++
* `tag`
* `div`
* `tbody__tag`
* `div`
* `cell__tag`
* `None`
* `row__tag`
* `div`
* `header__template`
* `None`
Methods
-------
`as_view`
^^^^^^^^^
`bulk_queryset`
^^^^^^^^^^^^^^^
Return the queryset that contains only the selected rows with
bulk_filter and bulk_exclude applied.
For use in post_handlers. Only valid when rows was a queryset.
`cells_for_rows`
^^^^^^^^^^^^^^^^
Yield a Cells instance for each visible row on the screen.
`get_visible_rows`
^^^^^^^^^^^^^^^^^^
`on_bind`
^^^^^^^^^
`on_refine_done`
^^^^^^^^^^^^^^^^
`own_evaluate_parameters`
^^^^^^^^^^^^^^^^^^^^^^^^^
`selection`
^^^^^^^^^^^
Return the selected rows.
For use in post_handlers. It's a queryset if rows is a queryset and a list otherwise.
Unlike bulk_queryset neither bulk_filter nor bulk_exclude are applied.
`should_render_form_tag`
^^^^^^^^^^^^^^^^^^^^^^^^
Class methods
-------------
`columns_from_model`
^^^^^^^^^^^^^^^^^^^^