Package Camelot :: Package camelot :: Package view :: Module filters :: Class ValidDateFilter |
[frames] | no frames]

# Class ValidDateFilter

source code

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

Instance Methods
__init__(self, from_attribute=`'``from_date``'`, thru_attribute=`'``thru_date``'`, verbose_name=_('Valid at')) @param attribute: the attribute on which to filter, this attribute may contain dots to indicate relationships that need to be followed, eg. 'person.groups.name' @param value_to_string: function that converts a value of the attribute to a string that will be displayed in the filter | source code
render(self, parent, name, options) 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) | source code
get_name_and_options(self, 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), ...) | source code
Inherited from `object`: `__delattr__`, `__format__`, `__getattribute__`, `__hash__`, `__new__`, `__reduce__`, `__reduce_ex__`, `__repr__`, `__setattr__`, `__sizeof__`, `__str__`, `__subclasshook__`

Properties
Inherited from `object`: `__class__`

Method Details

### __init__(self, from_attribute=`'``from_date``'`, thru_attribute=`'``thru_date``'`, verbose_name=_('Valid at')) (Constructor) | source code
@param attribute: the attribute on which to filter, this attribute may contain dots to indicate relationships that need to be followed, eg. 'person.groups.name' @param value_to_string: function that converts a value of the attribute to a string that will be displayed in the filter Parameters: `from_attribute` - the name of the attribute representing the from date `thru_attribute` - the name of the attribute representing the thru date `verbose_name` - the displayed name of the filter Overrides: object.__init__

### render(self, parent, name, options) | source code
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 Overrides: Filter.render (inherited documentation)

### get_name_and_options(self, admin) | source code
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), ...) Overrides: Filter.get_name_and_options (inherited documentation)