| 83 | | {{{ |
| 84 | | s3db.add_component("org_office", org_organisation={ |
| 85 | | "name": "headquarter", # the component alias |
| 86 | | "joinby": "organisation_id" # the foreign key |
| 87 | | "filterby": "office_type_id", # the name of the field in the component table to filter by |
| 88 | | "filterfor": 4, # the value(s) to filter for |
| 89 | | }) |
| | 83 | {{{#!python |
| | 84 | s3db.add_components("org_organisation", |
| | 85 | org_office={"name": "headquarter", # the component alias |
| | 86 | "joinby": "organisation_id" # the foreign key |
| | 87 | "filterby": "office_type_id", # the name of the field in the component table to filter by |
| | 88 | "filterfor": 4, # the value(s) to filter for |
| | 89 | }) |
| 100 | | {{{ |
| 101 | | s3db.add_component("org_office", org_organisation={ |
| 102 | | "name": "headquarter", # the component alias |
| 103 | | "joinby": "organisation_id" # the foreign key |
| 104 | | "filterby": "office_type_id", # the name of the field in the component table to filter by |
| 105 | | "filterfor": 4, # the value(s) to filter for |
| 106 | | "multiple": False # there can be only one component record per master record |
| 107 | | }) |
| | 100 | {{{#!python |
| | 101 | s3db.add_components("org_organisation", |
| | 102 | org_office={"name": "headquarter", # the component alias |
| | 103 | "joinby": "organisation_id" # the foreign key |
| | 104 | "filterby": "office_type_id", # the name of the field in the component table to filter by |
| | 105 | "filterfor": 4, # the value(s) to filter for |
| | 106 | "multiple": False # there can be only one component record per master record |
| | 107 | }) |
| 160 | | {{{ |
| 161 | | s3db.add_component("my_component", # Tablename of the component |
| 162 | | my_master=dict( # Tablename of the master table |
| 163 | | name="alias", # Use this 'alias' as the component name |
| 164 | | link="my_linktable", # Tablename of the link table |
| 165 | | joinby="fieldname", # FK of the master table (=left key constraint) |
| 166 | | key="fieldname", # FK of the component table (=right key constraint) |
| 167 | | actuate="replace", # Actuation option (see above, optional, defaults to "link") |
| 168 | | autodelete=False # Delete the component record together with the last link (optional, default is False) |
| 169 | | widget=Widget, # Widget to use for embedding (optional, defaults to S3EmbedComponentWidget) |
| 170 | | autocomplete="fieldname", # Field in the component to use for autocomplete when embedding the component |
| 171 | | )) |
| 172 | | |
| | 160 | {{{#!python |
| | 161 | s3db.add_components("my_master", # Tablename of the master table |
| | 162 | my_component={ # Tablename of the component |
| | 163 | name="alias", # Use this 'alias' as the component name |
| | 164 | link="my_linktable", # Tablename of the link table |
| | 165 | joinby="fieldname", # FK of the master table (=left key constraint) |
| | 166 | key="fieldname", # FK of the component table (=right key constraint) |
| | 167 | actuate="replace", # Actuation option (see above, optional, defaults to "link") |
| | 168 | autodelete=False # Delete the component record together with the last link (optional, default is False) |
| | 169 | widget=Widget, # Widget to use for embedding (optional, defaults to S3EmbedComponentWidget) |
| | 170 | autocomplete="fieldname", # Field in the component to use for autocomplete when embedding the component |
| | 171 | }) |