The horizon.tables.views ModuleΒΆ

class horizon.tables.views.DataTableView(*args, **kwargs)[source]

Bases: horizon.tables.views.MultiTableView

A class-based generic view to handle basic DataTable processing.

Three steps are required to use this view: set the table_class attribute with the desired DataTable class; define a get_data method which returns a set of data for the table; and specify a template for the template_name attribute.

Optionally, you can override the has_more_data method to trigger pagination handling for APIs that support it.

DataTableView.context_object_name = 'table'
DataTableView.get_context_data(**kwargs)[source]
DataTableView.get_data()[source]
DataTableView.get_table()[source]
DataTableView.get_tables()[source]
DataTableView.table_class = None
class horizon.tables.views.MixedDataTableView(*args, **kwargs)[source]

Bases: horizon.tables.views.DataTableView

A class-based generic view to handle DataTable with mixed data types.

Basic usage is the same as DataTableView.

Three steps are required to use this view: #. Set the table_class attribute with desired DataTable class. In the class the data_types list should have at least two elements.

#. Define a get_{{ data_type }}_data method for each data type which returns a set of data for the table.

  1. Specify a template for the template_name attribute.
MixedDataTableView.assign_type_string(data, type_string)[source]
MixedDataTableView.context_object_name = 'table'
MixedDataTableView.get_table()[source]
MixedDataTableView.table_class = None
class horizon.tables.views.MultiTableMixin(*args, **kwargs)[source]

Bases: object

A generic mixin which provides methods for handling DataTables.

MultiTableMixin.assign_type_string(data, type_name, data_type)[source]
MultiTableMixin.check_method_exist(func_pattern='%s', *names)[source]
MultiTableMixin.data_method_pattern = 'get_%s_data'
MultiTableMixin.get_context_data(**kwargs)[source]
MultiTableMixin.get_data_methods(table_classes, methods)[source]
MultiTableMixin.get_tables()[source]
MultiTableMixin.handle_table(table)[source]
MultiTableMixin.has_more_data(table)[source]
MultiTableMixin.wrap_func(data_func, type_name, data_type)[source]
class horizon.tables.views.MultiTableView(*args, **kwargs)[source]

Bases: horizon.tables.views.MultiTableMixin, django.views.generic.base.TemplateView

A class-based generic view to handle the display and processing of multiple DataTable classes in a single view.

Three steps are required to use this view: set the table_classes attribute with a tuple of the desired DataTable classes; define a get_{{ table_name }}_data method for each table class which returns a set of data for that table; and specify a template for the template_name attribute.

MultiTableView.construct_tables()[source]
MultiTableView.get(request, *args, **kwargs)[source]
MultiTableView.post(request, *args, **kwargs)[source]

Previous topic

The horizon.tables Module

Next topic

The horizon.tables.base Module

This Page