Changes between Version 13 and Version 14 of DeveloperGuidelines
- Timestamp:
- 12/24/08 00:57:03 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelines
v13 v14 19 19 The Models are loaded 1st within Web2Py processing, before the controllers. 20 20 So you can import any global modules/set any global variables here. 21 The Models are imported in alphabetical order, so we load the files which other modules depend on 1st, hence naming them {{{_db.py}}}, {{{_gis.py}}}21 The Models are imported in alphabetical order, so we load the files which other modules depend on 1st, hence naming them with an underscore: {{{_db.py}}}, {{{_gis.py}}} 22 22 23 23 === Controller === … … 47 47 48 48 === Conflict Detection === 49 Sahana is a multi-user system so there is a potential for multiple users to be editing the same record at once. 50 49 51 Add this field to each table which needs protecting (in {{{models/db.py}}}): 50 52 {{{ 51 53 SQLField('modified_on','datetime'), # Used by T2 to do edit conflict-detection 52 54 }}} 55 56 This field is also used in [wiki:DeveloperGuidelinesDatabaseSynchronization Database Synchronization] 53 57 54 58 == Sahana3 Framework == … … 79 83 {{{SQLField('field','text'),}}} 80 84 81 Form field can be made to use a SELECT dropdown by setting the field as a lookup to another table: 82 {{{SQLField('field',db.othertable),}}} 85 Form field can be made to use a SELECT dropdown by setting the field as a lookup to another table...linked to the 'uuid' field to allow [wiki:DeveloperGuidelinesDatabaseSynchronization Database Synchronization], but displaying a more user-friendly field (such as 'name'): 86 {{{ 87 SQLField('field',length=64), 83 88 84 Set this to use a different field than 'id' in the views (e.g. 'name') using: 85 {{{db.table.field.requires=IS_NULL_OR(IS_IN_DB(db,'othertable.id','othertable.name'))}}}89 db.table.field.requires=IS_NULL_OR(IS_IN_DB(db,'othertable.uuid','othertable.name')) 90 }}} 86 91 87 92 Form field being required can be marked using: