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 desiredDataTable
class; define aget_data
method which returns a set of data for the table; and specify a template for thetemplate_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_server_filter_info
(request)[source]
-
get_table
()[source]
-
get_tables
()[source]
-
handle_server_filter
(request)[source] Update the table server filter information in the session and determine if the filter has been changed.
-
post
(request, *args, **kwargs)[source]
-
table_class
= None
-
update_server_filter_action
()[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.
-
-
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 desiredDataTable
class. In the class thedata_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.- 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
- Specify a template for the
-
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_tables
()[source]
-
handle_table
(table, prefetch=True)[source]
-
has_more_data
(table)[source]
-
has_prev_data
(table)[source]
-
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 desiredDataTable
classes; define aget_{{ table_name }}_data
method for each table class which returns a set of data for that table; and specify a template for thetemplate_name
attribute.-
construct_tables
(prefetch=True)[source]
-
get
(request, *args, **kwargs)[source]
-
post
(request, *args, **kwargs)[source]
-