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.

context_object_name = 'table'
get_context_data(**kwargs)[source]
get_data()[source]
get_filters(filters=None, filters_map=None)[source]

Converts a string given by the user into a valid api filter value. :filters: Default filter values.

{‘filter1’: filter_value, ‘filter2’: filter_value}
Filters_map:mapping between user input and valid api filter values. {‘filter_name’:{_(“true_value”):True, _(“false_value”):False}
get_table()[source]
get_tables()[source]
post(request, *args, **kwargs)[source]
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.
assign_type_string(data, type_string)[source]
context_object_name = 'table'
get_table()[source]
table_class = None
class horizon.tables.views.MultiTableMixin(*args, **kwargs)[source]

Bases: object

A generic mixin which provides methods for handling DataTables.

assign_type_string(data, type_name, data_type)[source]
check_method_exist(func_pattern='%s', *names)[source]
data_method_pattern = 'get_%s_data'
get_context_data(**kwargs)[source]
get_data_methods(table_classes, methods)[source]
get_server_filter_info(request, table=None)[source]
get_tables()[source]
handle_server_filter(request, table=None)[source]

Update the table server filter information in the session and determine if the filter has been changed.

handle_table(table)[source]
has_more_data(table)[source]
has_prev_data(table)[source]
needs_filter_first(table)[source]
update_server_filter_action(request, table=None)[source]

Update the table server side filter action based on the current filter. The filter info may be stored in the session and this will restore it.

wrap_func(data_func, type_name, data_type)[source]
class horizon.tables.views.MultiTableView(*args, **kwargs)[source]

Bases: horizon.tables.views.MultiTableMixin, horizon.views.HorizonTemplateView

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.

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

Previous topic

The horizon.browsers.base Module

Next topic

The horizon.tables Module

Project Source

This Page