Filter options
FilterOption
¶
Class representing a filter option.
These are more prescribed options available on certain resources, such as the specimens and index lot resources, and typically are shown as tick boxes.
Source code in ckanext/nhm/lib/filter_options.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | |
__init__(name, label, filter_dsl, hide=False)
¶
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
the name of the option, this is the name passed through in the filter |
required | |
label
|
the text to show on the frontend to the user |
required | |
filter_dsl
|
an elasticsearch-dsl query object which actually does the filter. This is applied in the ckanext-nhm plugin. |
required | |
hide
|
whether to hide the filter on the frontend or show it, default is False (i.e. show the filter option) |
False
|
Source code in ckanext/nhm/lib/filter_options.py
20 21 22 23 24 25 26 27 28 29 30 31 32 | |
as_dict()
¶
Produces a dict with the details required by the frontend to show the filter options to the user.
Returns:
| Type | Description |
|---|---|
|
a dict with the name and the label for the filter |
Source code in ckanext/nhm/lib/filter_options.py
34 35 36 37 38 39 40 41 42 43 44 | |