apis_core.generic.tables#

Module Contents#

Classes#

CustomTemplateColumn

A custom template column - the tables.TemplateColumn class does not allow to set attributes via class variables. Therefor we use this CustomTemplateColumn to set some arguments based on class attributes and override the attributes in child classes.

ActionColumn

A custom template column with some additional attributes for actions.

ActionsColumn

DescriptionColumn

A column showing a model description

GenericTable

A generic table that contains an edit button column, a delete button column and a description column

MoreLessColumn

Useful for displaying long fields. A preview is shown initially with a “Show more” link which is replaced with a “Show less” link when expanded.

API#

class apis_core.generic.tables.CustomTemplateColumn(*args, **kwargs)[source]#

Bases: django_tables2.TemplateColumn

A custom template column - the tables.TemplateColumn class does not allow to set attributes via class variables. Therefor we use this CustomTemplateColumn to set some arguments based on class attributes and override the attributes in child classes.

Initialization

template_name = None#
orderable = None#
exclude_from_export = False#
verbose_name = None#
class apis_core.generic.tables.ActionColumn(*args, **kwargs)[source]#

Bases: apis_core.generic.tables.CustomTemplateColumn

A custom template column with some additional attributes for actions.

Initialization

orderable = False#
exclude_from_export = True#
attrs = None#
render(record, table, *args, **kwargs)[source]#
class apis_core.generic.tables.ActionsColumn(*args, **kwargs)[source]#

Bases: apis_core.generic.tables.CustomTemplateColumn

orderable = False#
exclude_from_export = True#
template_name = 'columns/actions.html'#
attrs = None#
class apis_core.generic.tables.DescriptionColumn(*args, **kwargs)[source]#

Bases: apis_core.generic.tables.CustomTemplateColumn

A column showing a model description

Initialization

template_name = 'columns/description.html'#
orderable = False#
class apis_core.generic.tables.GenericTable(data=None, order_by=None, orderable=None, empty_text=None, exclude=None, attrs=None, row_attrs=None, pinned_row_attrs=None, sequence=None, prefix=None, order_by_field=None, page_field=None, per_page_field=None, template_name=None, default=None, request=None, show_header=None, show_footer=True, extra_columns=None)[source]#

Bases: django_tables2.Table

A generic table that contains an edit button column, a delete button column and a description column

Initialization

desc = 'DescriptionColumn(...)'#
actions = 'ActionsColumn(...)'#
class Meta[source]#
fields = ['id', 'desc']#
sequence = ('...', 'actions')#
class apis_core.generic.tables.MoreLessColumn(preview, fulltext, *args, **kwargs)[source]#

Bases: django_tables2.TemplateColumn

Useful for displaying long fields. A preview is shown initially with a “Show more” link which is replaced with a “Show less” link when expanded.

Initialization

template_name = 'columns/more-less.html'#
render(record, **kwargs)[source]#