Changes between Version 17 and Version 18 of DeveloperGuidelinesNewModule


Ignore:
Timestamp:
01/15/09 22:12:50 (13 years ago)
Author:
Fran Boon
Comment:

Update to current API

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelinesNewModule

    v17 v18  
    3232{{{
    3333if not len(db().select(db['%s' % table].ALL)):
    34         db['%s' % table].insert(
     34        db[table].insert(
    3535        name="Home",
    3636        function="index",
     
    3939        enabled='True'
    4040        )
    41         db['%s' % table].insert(
     41        db[table].insert(
    4242        name="Add Vehicle",
    4343        function="vehicle/create",
     
    4646        enabled='True'
    4747        )
    48         db['%s' % table].insert(
     48        db[table].insert(
    4949        name="List Vehicles",
    5050        function="vehicle",
    5151        priority=2,
     52        description="List information of all vehicles",
     53        enabled='True'
     54        )
     55        db[table].insert(
     56        name="Search Vehicles",
     57        function="vehicle/search",
     58        priority=3,
    5259        description="List information of all vehicles",
    5360        enabled='True'
     
    6370resource='vehicle'
    6471table=module+'_'+resource
    65 db.define_table(table,
    66                 SQLField('modified_on','datetime',default=now),
    67                 SQLField('uuid',length=64,default=uuid.uuid4()),
     72db.define_table(table,timestamp,uuidstamp,
    6873                SQLField('name'))
    69 db['%s' % table].represent=lambda table:shn_list_item(table,resource='vehicle',action='display')
     74exec("s3.crud_fields.%s=['name']" % table)
     75db[table].exposes=s3.crud_fields[table]
     76db[table].uuid.requires=IS_NOT_IN_DB(db,'%s.uuid' % table)
    7077db.veh_vehicle.name.requires=IS_NOT_EMPTY()
    7178db.veh_vehicle.name.comment=SPAN("*",_class="req")
     
    7885title_list=T('List Vehicles')
    7986title_update=T('Edit Vehicle')
     87title_search=T('Search Vehicles')
    8088subtitle_create=T('Add New Vehicle')
    8189subtitle_list=T('Vehicles')
     
    8694msg_record_deleted=T('Vehicle deleted')
    8795msg_list_empty=T('No Vehicles currently registered')
    88 exec('crud_strings.%s=Storage(title_create=title_create, title_display=title_display, title_list=title_list, title_update=title_update, subtitle_create=subtitle_create, subtitle_list=subtitle_list, label_list_button=label_list_button, label_create_button=label_create_button, msg_record_created=msg_record_created, msg_record_modified=msg_record_modified, msg_record_deleted=msg_record_deleted, msg_list_empty=msg_list_empty)' % resource)
     96exec('crud_strings.%s=Storage(title_create=title_create, title_display=title_display, title_list=title_list, title_update=title_update, subtitle_create=subtitle_create, subtitle_list=subtitle_list, label_list_button=label_list_button, label_create_button=label_create_button, msg_record_created=msg_record_created, msg_record_modified=msg_record_modified, msg_record_deleted=msg_record_deleted, msg_list_empty=msg_list_empty)' % table)
    8997}}}
    9098
     
    115123Add HTML templates for any custom functions: {{{/views/module/function.html}}}
    116124
    117 NB Only {{{index.html}}} is required to start with since the RESTful controller re-uses standard views
     125NB Only {{{index.html}}} is required to start with since the RESTful controller normally re-uses standard views.[[BR]]
     126If Custom Views are wanted they are detected automatically if files are found in {{{/views/module/resource_method.html}}}
    118127
    119128DeveloperGuidelines