just an idea why not define table in sequence number?
first analyze the whole system and define table on order (define table first (low number) for the table with no relation to another table)
e.g.
models/db_schema_0_auth.py
auth.define_tables(username = True, signature = True)
models/db_schema_1_address.py
db.define_table('address',
Field('address', 'text'),
format = lambda r: '%s' % (r.address) )
models/db_schema_2_id_card.py
db.define_table('id_card',
Field('id_card_number'),
Field('first_name'),
Field('last_name'),
Field('address', 'reference address'),
format = lambda r: '%s - %s %s' % (r.id_card_number, r.first_name, r.last_name) )
best regards,
stifan