The horizon.tables.views ModuleΒΆ
-
class
horizon.tables.views.DataTableView(*args, **kwargs)[source] Bases:
horizon.tables.views.MultiTableViewA class-based generic view to handle basic DataTable processing.
Three steps are required to use this view: set the
table_classattribute with the desiredDataTableclass; define aget_datamethod which returns a set of data for the table; and specify a template for thetemplate_nameattribute.Optionally, you can override the
has_more_datamethod 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.DataTableViewA 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_classattribute with desiredDataTableclass. In the class thedata_typeslist should have at least two elements.#. Define a
get_{{ data_type }}_datamethod for each data type which returns a set of data for the table.- Specify a template for the
template_nameattribute.
-
assign_type_string(data, type_string)[source]
-
context_object_name= 'table'
-
get_table()[source]
-
table_class= None
- Specify a template for the
-
class
horizon.tables.views.MultiTableMixin(*args, **kwargs)[source] Bases:
objectA 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.HorizonTemplateViewA class-based generic view to handle the display and processing of multiple
DataTableclasses in a single view.Three steps are required to use this view: set the
table_classesattribute with a tuple of the desiredDataTableclasses; define aget_{{ table_name }}_datamethod for each table class which returns a set of data for that table; and specify a template for thetemplate_nameattribute.-
construct_tables()[source]
-
get(request, *args, **kwargs)[source]
-
post(request, *args, **kwargs)[source]
-