Changes between Initial Version and Version 1 of DeveloperGuidelinesNewModule


Ignore:
Timestamp:
12/20/08 05:09:40 (13 years ago)
Author:
Fran Boon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelinesNewModule

    v1 v1  
     1DeveloperGuidelines
     2
     3== How to add a new module? ==
     4
     5Copy an existing module & edit!
     6
     7== Model ==
     8Add module to db.module:
     9 * http://127.0.0.1:8000/sahana/appadmin/select/db?query=db.module.id%3E0
     10
     11Create a file {{{/models/module.py}}}
     12This needs a table to store the module's menu options in:
     13{{{
     14module='name'
     15
     16# Menu Options
     17db.define_table('%s_menu_option' % module,
     18                SQLField('name'),
     19                SQLField('function'),
     20                SQLField('description',length=256),
     21                SQLField('priority','integer'),
     22                SQLField('enabled','boolean',default='True'))
     23db['%s_menu_option' % module].name.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'%s_menu_option.name' % module)]
     24db['%s_menu_option' % module].name.requires=IS_NOT_EMPTY()
     25db['%s_menu_option' % module].priority.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'%s_menu_option.priority' % module)]
     26}}}
     27
     28Add additional tables to this file, as-required.
     29To avoid namespace clashes, use the format: {{{db.module_table}}}
     30
     31=== Controller ===
     32Add CRUD functions for these tables to {{{/controllers/module.py}}}
     33=== View ===
     34Add HTML templates for these functions: {{{/views/module/function.html}}}
     35
     36DeveloperGuidelines