Package s3 :: Module s3filter :: Class S3LocationFilter
[frames] | no frames]

Class S3LocationFilter

source code

    object --+    
             |    
S3FilterWidget --+
                 |
                S3LocationFilter

Hierarchical Location Filter Widget

NB This will show records linked to all child locations of the Lx

Configuration options:

** Widget appearance:

Instance Methods
 
__init__(self, field=None, **attr)
Constructor to configure the widget
source code
 
widget(self, resource, values)
Render this widget as HTML helper object(s)
source code
 
data_element(self, variable)
Construct the hidden element that holds the URL query term corresponding to an input element in the widget.
source code
 
ajax_options(self, resource) source code
 
get_lx_ancestors(self, levels, resource, selector=None, location_ids=None, path=False)
Look up the immediate Lx ancestors of relevant levels for all locations referenced by selector
source code

Inherited from S3FilterWidget: __call__, variable

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  operator = "belongs"

Inherited from S3FilterWidget: alternatives

Properties

Inherited from object: __class__

Method Details

__init__(self, field=None, **attr)
(Constructor)

source code 

Constructor to configure the widget

Parameters:
  • field - the selector(s) for the field(s) to filter by
  • attr - configuration options for this widget
  • label - label for the widget
  • comment - comment for the widget
  • hidden - render widget initially hidden (="advanced" option)
  • no_opts - text to show if no options available

    ** Options-lookup:

  • levels - list of location hierarchy levels
  • resource - alternative resource to look up options
  • lookup - field in the alternative resource to look up
  • options - fixed set of options (list of gis_location IDs)

    ** Multiselect-dropdowns:

  • search - show search-field to search for options
  • header - show header with bulk-actions
  • selectedList - number of selected items to show on button before collapsing into number of items
Overrides: object.__init__

widget(self, resource, values)

source code 

Render this widget as HTML helper object(s)

Parameters:
  • resource - the resource
  • values - the search values from the URL query
Overrides: S3FilterWidget.widget

data_element(self, variable)

source code 

Construct the hidden element that holds the URL query term corresponding to an input element in the widget.

Parameters:
  • variable - the URL query variable
Overrides: S3FilterWidget.data_element

ajax_options(self, resource)

source code 

get_lx_ancestors(self, levels, resource, selector=None, location_ids=None, path=False)

source code 

Look up the immediate Lx ancestors of relevant levels for all locations referenced by selector

Parameters:
  • levels - the relevant Lx levels, tuple of "L1", "L2" etc
  • resource - the master resource
  • selector - the selector for the location reference
Returns:
gis_location Rows, or empty list

Class Variable Details

operator

Value:
"belongs"