filters
Python structures to represent filters.
These structures can be transformed to QT forms.
-
class camelot.view.filters.ComboBoxFilter(attribute, default=<class 'camelot.view.filters.All'>)[source]
Filter where the items are displayed in a QComboBox
-
class camelot.view.filters.DateFilterWidget(filter_data, parent)[source]
Filter widget based on a DateEditor
-
class camelot.view.filters.EditorFilter(field_name, verbose_name=None, default_operator=None, default_value_1=None, default_value_2=None)[source]
Filter that presents the user with an editor, allowing the user to enter
a value on which to filter, and at the same time to show ‘All’ or ‘None’
Parameters: |
- field_name – the name fo the field on the class on which to filter
- default_operator – a default operator to be used, on of the attributes
of the python module operator, such as operator.eq
- default_value_1 – a default value for the first editor (in case the
default operator in unary or binary
- default_value_2 – a default value for the second editor (in case the
default operator is binary)
|
-
class camelot.view.filters.Filter(attribute, default=<class 'camelot.view.filters.All'>)[source]
Base class for filters
-
get_filter_data(admin)[source]
-
-
render(parent, name, options)[source]
Render this filter as a qt object
@param parent: its parent widget
@param name: the name of the filter
@param options: the options that can be selected, where each option is a list
of tuples containting (option_name, query_decorator)
The name and the list of options can be fetched with get_name_and_options
-
class camelot.view.filters.FilterWidget(filter_data, parent)[source]
A box containing a filter that can be applied on a table view, this filter is
based on the distinct values in a certain column
-
class camelot.view.filters.GroupBoxFilter(attribute, default=<class 'camelot.view.filters.All'>)[source]
Filter where the items are displayed in a QGroupBox
-
class camelot.view.filters.GroupBoxFilterWidget(filter_data, parent)[source]
Flter widget based on a QGroupBox
-
class camelot.view.filters.ValidDateFilter(from_attribute='from_date', thru_attribute='thru_date', verbose_name=_('Valid at'), default=<built-in method today of type object at 0x7f2e06ca1e00>)[source]
Filters entities that are valid a certain date. This filter will present
a date to the user and filter the entities that have their from date before this
date and their end date after this date. If no date is given, all entities will
be shown
-
class camelot.view.filters.filter_data
filter_data(name, options, default)
-
default
Alias for field number 2
-
name
Alias for field number 0
-
options
Alias for field number 1
-
class camelot.view.filters.filter_option
filter_option(name, value, decorator)
-
decorator
Alias for field number 2
-
name
Alias for field number 0
-
value
Alias for field number 1
-
camelot.view.filters.structure_to_filter(structure)[source]
Convert a python data structure to a filter, using the following rules :
if structure is an instance of Filter, return structure
else create a GroupBoxFilter from the structure