| 320 | | Components can be defined in S3Models using the {{{add_component}}} method: |
| 321 | | |
| 322 | | {{{ |
| 323 | | current.s3db.add_component(<component_table_name>, <master_table_name>=<join>) |
| 324 | | }}} |
| 325 | | |
| 326 | | The {{{add_component()}}} method is available both in {{{S3Model}}} instances ({{{self.add_component}}}, {{{s3db.add_component}}}) as well as from the class ({{{S3Model.add_component}}}). |
| | 316 | Components are sub-tables of a master entity ("has"-relationship). |
| | 317 | |
| | 318 | Components can be defined in S3Models using the {{{add_component}}} method, e.g. |
| | 319 | |
| | 320 | {{{#!python |
| | 321 | # Offices (org_office table) are a component of organisations (org_organisation table), |
| | 322 | # linked through the organisation_id field in org_office |
| | 323 | current.s3db.add_component("org_office", org_organisation="organisation_id") |
| | 324 | }}} |