Changes between Version 33 and Version 34 of S3/S3Model/SuperEntities
- Timestamp:
- 04/01/14 12:12:17 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
S3/S3Model/SuperEntities
v33 v34 96 96 === Linking to a Super-Entity === 97 97 98 Both, instance tables as well as shared components need to be linked to the super-entity. This can be done by inserting a ''super-key'' field into the instance/component table which must have the same name as the primary key of the super-entity. You can use the {{{super_link()}}} function as a DRY method for this:98 Both, instance tables as well as shared components need to be linked to the super-entity. 99 99 100 {{{ 100 This can be done by inserting a ''super-key'' field into the instance/component table which must have the same name as the primary key of the super-entity. You can use the {{{super_link()}}} function to do this: 101 102 {{{#!python 101 103 tablename = "pr_presence" 102 104 table = db.define_table(tablename, … … 108 110 Note: {{{super_link}}} generates a {{{Field}}} instance - if you just need the name of the super-key field, you can use: 109 111 110 {{{ 112 {{{#!python 111 113 sk = s3db.super_key(db.pr_pentity) # returns the string "pe_id" 112 114 }}} 115 116 ...or just type the field name (best option in models with lazy tables). 113 117 === Updating a Super-Entity === 114 118