Changes between Version 49 and Version 50 of S3/S3Model/ComponentResources
- Timestamp:
- 02/07/14 10:52:34 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
S3/S3Model/ComponentResources
v49 v50 98 98 === Filtered Components === 99 99 100 Component joins can be filtered , so that only a subset of the records in the component table forms the actual component:100 Component joins can be filtered to a subset of the records in the component table: 101 101 102 102 {{{#!python 103 103 s3db.add_components("org_organisation", 104 104 org_office={"name": "headquarter", # the component alias 105 "joinby": "organisation_id" 105 "joinby": "organisation_id", # the foreign key 106 106 "filterby": "office_type_id", # the name of the field in the component table to filter by 107 "filterfor": 4, # the value(s) to filter for 108 }) 107 "filterfor": [4], # the value(s) to filter for 108 }, 109 ) 109 110 }}} 110 111 111 112 Currently only inclusive filters are supported. 112 113 113 It is possible to link the same component table to the same master table more than once using different joins and/or filters. 114 114 It is possible to link the same component table to the same master table more than once using different aliases with joins and/or filters: 115 116 {{{#!python 117 s3db.add_components("org_organisation", 118 org_office=( 119 {"name": "headquarter", 120 "joinby": "organisation_id", 121 "filterby": "office_type_id", 122 "filterfor": [4], 123 }, 124 {"name": "fieldoffice", 125 "joinby": "organisation_id", 126 "filterby": "office_type_id", 127 "filterfor": [5], 128 }, 129 ), 130 ) 131 }}} 115 132 === Single / Multiple Component Records === 116 133