Package s3 :: Module s3widgets :: Class S3EmbeddedComponentWidget
[frames] | no frames]

Class S3EmbeddedComponentWidget

source code

??-283 --+
         |
        S3EmbeddedComponentWidget

Widget used by S3CRUD for link-table components with actuate="embed". Uses s3.embed_component.js for client-side processing, and S3CRUD._postprocess_embedded to receive the data.

Instance Methods
 
__init__(self, link=None, component=None, autocomplete=None, link_filter=None, select_existing=True)
Constructor
source code
 
__call__(self, field, value, **attributes)
Widget renderer
source code
Static Methods
 
link_filter_query(table, expression)
Parse a link filter expression and convert it into an S3ResourceQuery that can be added to the search_ac resource.
source code
Method Details

__init__(self, link=None, component=None, autocomplete=None, link_filter=None, select_existing=True)
(Constructor)

source code 

Constructor

Parameters:
  • link - the name of the link table
  • component - the name of the component table
  • autocomplete - name of the autocomplete field
  • link_filter - filter expression to filter out records in the component that are already linked to the main record
  • select_existing - allow the selection of existing component records from the registry

__call__(self, field, value, **attributes)
(Call operator)

source code 

Widget renderer

Parameters:
  • field - the Field
  • value - the current value
  • attributes - the HTML attributes for the widget

link_filter_query(table, expression)
Static Method

source code 

Parse a link filter expression and convert it into an
S3ResourceQuery that can be added to the search_ac resource.

Link filter expressions are used to exclude records from
the (autocomplete-)search that are already linked to the master
record.

General format:
    ?link=<linktablename>.<leftkey>.<id>.<rkey>.<fkey>

Example:
    ?link=project_organisation.organisation_id.5.project_id.id

@param expression: the link filter expression