Changes between Version 2 and Version 3 of S3/S3Profile
- Timestamp:
- 05/12/14 11:50:10 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
S3/S3Profile
v2 v3 24 24 == Configuration == 25 25 The profile pages are configured by configuring a few profile_* variables and storing these against the tablename with the usual {{{s3db.configure(tablename, key=value)}}}, e.g.: 26 {{{ 26 {{{#!python 27 27 s3db.configure(tablename, 28 28 profile_title = title, … … 48 48 * {{{profile_widgets}}} are the Widgets (see below) 49 49 * {{{profile_layers}}} are additional layers to display on the map, defined like: 50 {{{ 50 {{{#!python 51 51 layer = dict(name = record_name, 52 52 id = "profile-header-%s-%s" % (tablename, record_id), … … 61 61 === Widget configuration === 62 62 Here is an example configuration for a map widget: 63 {{{ 63 {{{#!python 64 64 map_widget = dict(label = "Map", 65 65 type = "map", … … 79 79 80 80 Here is an example configuration for a datalist widget: 81 {{{ 81 {{{#!python 82 82 alerts_widget = dict(label = "Alerts", 83 83 label_create = "Create Alert", … … 99 99 100 100 NB You should ensure that your create forms establish the context link automatically. This is usually done by checking for a context filter, and then setting table.field.default, e.g.: 101 {{{ 101 {{{#!python 102 102 incident_id = get_vars.get("~.(incident)", None) 103 103 if incident_id: … … 108 108 109 109 If the link is via a link table then you need to add the link onaccept, e.g.: 110 {{{ 110 {{{#!python 111 111 incident_id = r.get_vars.get("~.(incident)", None) 112 112 if incident_id: … … 126 126 127 127 The hook to link the 'profile' method to this class is in {{{s3_rest_controller()}}} in {{{models/00_utils.py}}}: 128 {{{ 128 {{{#!python 129 129 set_handler("profile", s3base.S3Profile) 130 130 }}} … … 156 156 * Allow component resources to be filtered 157 157 * Comments widget 158 * Use widget() function of target method handler instead of internal widgets 158 159 159 160 == See Also ==