Changes between Version 15 and Version 16 of DeveloperGuidelinesNewModule


Ignore:
Timestamp:
01/10/09 10:00:15 (13 years ago)
Author:
Fran Boon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelinesNewModule

    v15 v16  
    2828db['%s_menu_option' % module].name.requires=IS_NOT_EMPTY()
    2929db['%s_menu_option' % module].priority.requires=[IS_NOT_EMPTY(),IS_NOT_IN_DB(db,'%s_menu_option.priority' % module)]
     30}}}
     31Populate this table with the functions that you wish to expose to the module's front page & left-hand navigation bar:
     32{{{
     33if 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        )
    3055}}}
    3156
     
    6590
    6691=== Controller ===
    67 Add CRUD functions for these tables to {{{/controllers/module.py}}}:
     92Create a file: {{{/controllers/module.py}}}
     93
     94Add the T2 framework functions:
     95{{{
     96# T2 framework functions
     97def login(): redirect(URL(r=request,c='default',f='login'))
     98def logout(): t2.logout(next='login')
     99def register(): redirect(URL(r=request,c='default',f='register'))
     100def profile(): redirect(URL(r=request,c='default',f='profile'))
     101}}}
     102
     103Add CRUD functions for your tables:
    68104{{{
    69105def vehicle():
     
    74110Manual method for if/when you need more control: DeveloperGuidelinesCreateReadUpdateDelete
    75111
    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 
    78112=== Views ===
    79113Add HTML templates for any custom functions: {{{/views/module/function.html}}}