Changes between Version 15 and Version 16 of DeveloperGuidelinesNewModule
- Timestamp:
- 01/10/09 10:00:15 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelinesNewModule
v15 v16 28 28 db['%s_menu_option' % module].name.requires=IS_NOT_EMPTY() 29 29 db['%s_menu_option' % module].priority.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'%s_menu_option.priority' % module)] 30 }}} 31 Populate this table with the functions that you wish to expose to the module's front page & left-hand navigation bar: 32 {{{ 33 if not len(db().select(db['%s' % table].ALL)): 34 db['%s' % table].insert( 35 name="Home", 36 function="index", 37 priority=0, 38 description="Home", 39 enabled='True' 40 ) 41 db['%s' % table].insert( 42 name="Add Vehicle", 43 function="vehicle/create", 44 priority=1, 45 description="Add a vehicle to the database", 46 enabled='True' 47 ) 48 db['%s' % table].insert( 49 name="List Vehicles", 50 function="vehicle", 51 priority=2, 52 description="List information of all vehicles", 53 enabled='True' 54 ) 30 55 }}} 31 56 … … 65 90 66 91 === Controller === 67 Add CRUD functions for these tables to {{{/controllers/module.py}}}: 92 Create a file: {{{/controllers/module.py}}} 93 94 Add the T2 framework functions: 95 {{{ 96 # T2 framework functions 97 def login(): redirect(URL(r=request,c='default',f='login')) 98 def logout(): t2.logout(next='login') 99 def register(): redirect(URL(r=request,c='default',f='register')) 100 def profile(): redirect(URL(r=request,c='default',f='profile')) 101 }}} 102 103 Add CRUD functions for your tables: 68 104 {{{ 69 105 def vehicle(): … … 74 110 Manual method for if/when you need more control: DeveloperGuidelinesCreateReadUpdateDelete 75 111 76 Populate the module's menu_options table with the functions that you wish to expose to the module's front page & left-hand navigation bar.77 78 112 === Views === 79 113 Add HTML templates for any custom functions: {{{/views/module/function.html}}}