filters — Camelot documentation

### Navigation

- index
- modules |
- next |
- previous |
- Camelot documentation »
- Camelot API »
- view »

# 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'>)

  Filter where the items are displayed in a QComboBox

class `camelot.view.filters.` `DateFilterWidget`(name, query_decorator, default, parent)

  Filter widget based on a DateEditor

class `camelot.view.filters.` `EditorFilter`(field_name, verbose_name=None)

  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’

class `camelot.view.filters.` `Filter`(attribute, default=<class 'camelot.view.filters.All'>)

  Base class for filters

  `get_name_and_options`(admin)

    return a tuple of the name of the filter and a list of options that can be selected. Each option is a tuple of the name of the option, and a filter function to decorate a query @return: (filter_name, [(option_name, query_decorator), ...)

  `render`(*args, **kwargs)

    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`(name, choices, parent)

  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'>)

  Filter where the items are displayed in a QGroupBox

class `camelot.view.filters.` `GroupBoxFilterWidget`(name, choices, parent)

  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 0x42d07440>)

  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

`camelot.view.filters.` `structure_to_filter`(structure)

  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

### Navigation

- index
- modules |
- next |
- previous |
- Camelot documentation »
- Camelot API »
- view »

Comments
blog comments powered by Disqus