Changes between Version 36 and Version 37 of DeveloperGuidelinesNewModule
- Timestamp:
- 06/09/10 21:00:51 (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelinesNewModule
v36 v37 4 4 Summary: 5 5 * Copy an existing module, paste & edit. 6 * You will need to delete the database in order to load the new model (del ...\sahana\databases\*.*.)7 6 * Good modules to look at to start with are or & cr as these are simplest & standard. 8 7 9 8 === Model === 10 Add module to db.s3_module: 11 * http://127.0.0.1:8000/eden/appadmin/select/db?query=db.s3_module.id%3E0 9 Add module to {{{models/01_modules.py}}} 12 10 13 This makes it visible on the front page & the left-hand navigation menu. 11 Activate it in {{{models/000_config.py}}} 14 12 15 To make this change in code not just in this instance, then edit {{{/models/01_modules.py}}}: 16 {{{ 17 # Populate table with Default modules 18 if not len(db().select(table.ALL)): 19 table.insert( 20 name="veh", 21 name_nice="Vehicle Management System", 22 priority=<INSERT NEXT SEQUENTIAL PRIORITY HERE>, 23 description="Allows the management of vehicles", 24 enabled="True" 25 ) 26 }}} 27 28 You will need to delete the database in order to load the new model (del ...\eden\databases\*.*.) 13 This makes it visible on the front page & the menu. 29 14 30 15 Create a file {{{/models/<MODULE NAME>.py}}} … … 37 22 module = 'veh' 38 23 resource = 'vehicle' 39 40 # Current Module (for sidebar title)41 module_name = db(db.s3_module.name==module).select().first().name_nice42 24 43 25 tablename = module + '_' + resource … … 74 56 {{{ 75 57 module = 'veh' 76 # Current Module (for sidebar title)77 module_name = db(db.s3_module.name==module).select().first().name_nice78 58 79 59 # Options Menu (available in all Functions' Views) … … 103 83 104 84 DeveloperGuidelines 105 DeveloperGuidelines