wiki:DeveloperGuidelinesNewModule

Version 1 (modified by Fran Boon, 16 years ago) ( diff )

--

DeveloperGuidelines

How to add a new module?

Copy an existing module & edit!

Model

Add module to db.module:

Create a file /models/module.py This needs a table to store the module's menu options in:

module='name'

# Menu Options
db.define_table('%s_menu_option' % module,
                SQLField('name'),
                SQLField('function'),
                SQLField('description',length=256),
                SQLField('priority','integer'),
                SQLField('enabled','boolean',default='True'))
db['%s_menu_option' % module].name.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'%s_menu_option.name' % module)]
db['%s_menu_option' % module].name.requires=IS_NOT_EMPTY()
db['%s_menu_option' % module].priority.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'%s_menu_option.priority' % module)]

Add additional tables to this file, as-required. To avoid namespace clashes, use the format: db.module_table

Controller

Add CRUD functions for these tables to /controllers/module.py

View

Add HTML templates for these functions: /views/module/function.html

DeveloperGuidelines

Note: See TracWiki for help on using the wiki.