Changes between Version 13 and Version 14 of DeveloperGuidelines


Ignore:
Timestamp:
12/24/08 00:57:03 (13 years ago)
Author:
Fran Boon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines

    v13 v14  
    1919The Models are loaded 1st within Web2Py processing, before the controllers.
    2020So 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}}}
     21The 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}}}
    2222
    2323=== Controller ===
     
    4747
    4848=== Conflict Detection ===
     49Sahana is a multi-user system so there is a potential for multiple users to be editing the same record at once.
     50
    4951Add this field to each table which needs protecting (in {{{models/db.py}}}):
    5052{{{
    5153SQLField('modified_on','datetime'), # Used by T2 to do edit conflict-detection
    5254}}}
     55
     56This field is also used in [wiki:DeveloperGuidelinesDatabaseSynchronization Database Synchronization]
    5357
    5458== Sahana3 Framework ==
     
    7983   {{{SQLField('field','text'),}}}
    8084
    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),}}}
     85Form 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{{{
     87SQLField('field',length=64),
    8388
    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'))}}}
     89db.table.field.requires=IS_NULL_OR(IS_IN_DB(db,'othertable.uuid','othertable.name'))
     90}}}
    8691
    8792Form field being required can be marked using: