Package s3 :: Module s3hierarchy :: Class S3HierarchyCRUD
[frames] | no frames]

Class S3HierarchyCRUD

source code

     object --+    
              |    
s3rest.S3Method --+
                  |
                 S3HierarchyCRUD

Method handler for hierarchical CRUD

Instance Methods
 
apply_method(self, r, **attr)
Entry point for REST interface
source code
 
tree(self, r, **attr)
Page load
source code
 
node_json(self, r, **attr)
Return a single node as JSON (id, parent and label)
source code
 
render_tree(self, widget_id, record=None)
Render the tree
source code
 
export_xls(self, r, **attr)
Export nodes in the hierarchy in XLS format, including ancestor references.
source code

Inherited from s3rest.S3Method: __call__, widget

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

Static Methods
 
include_scripts(widget_id, widget_opts)
Include JS & CSS needed for hierarchical CRUD
source code

Inherited from s3rest.S3Method: crud_string

Properties

Inherited from object: __class__

Method Details

apply_method(self, r, **attr)

source code 

Entry point for REST interface

Parameters:
  • r - the S3Request
  • attr - controller attributes
Returns:
output object to send to the view
Overrides: s3rest.S3Method.apply_method

tree(self, r, **attr)

source code 

Page load

Parameters:
  • r - the S3Request
  • attr - controller attributes

node_json(self, r, **attr)

source code 

Return a single node as JSON (id, parent and label)

Parameters:
  • r - the S3Request
  • attr - controller attributes

render_tree(self, widget_id, record=None)

source code 

Render the tree

Parameters:
  • widget_id - the widget ID
  • record - the root record (if requested)

include_scripts(widget_id, widget_opts)
Static Method

source code 

Include JS & CSS needed for hierarchical CRUD

export_xls(self, r, **attr)

source code 

Export nodes in the hierarchy in XLS format, including
ancestor references.

This is controlled by the hierarchy_export setting, which is
a dict like:
{
    "field": "name",        - the field name for the ancestor reference
    "root": "Organisation"  - the label for the root level
    "branch": "Branch"      - the label for the branch levels
    "prefix": "Sub"         - the prefix for the branch label
}

With this configuration, the ancestor columns would appear like:

Organisation, Branch, SubBranch, SubSubBranch, SubSubSubBranch,...

All parts of the setting can be omitted, the defaults are as follows:
- "field" defaults to "name"
- "root" is automatically generated from the resource name
- "branch" defaults to prefix+root
- "prefix" defaults to "Sub"

@status: experimental