Changes between Version 17 and Version 18 of DeveloperGuidelinesNewModule
- Timestamp:
- 01/15/09 22:12:50 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelinesNewModule
v17 v18 32 32 {{{ 33 33 if not len(db().select(db['%s' % table].ALL)): 34 db[ '%s' %table].insert(34 db[table].insert( 35 35 name="Home", 36 36 function="index", … … 39 39 enabled='True' 40 40 ) 41 db[ '%s' %table].insert(41 db[table].insert( 42 42 name="Add Vehicle", 43 43 function="vehicle/create", … … 46 46 enabled='True' 47 47 ) 48 db[ '%s' %table].insert(48 db[table].insert( 49 49 name="List Vehicles", 50 50 function="vehicle", 51 51 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, 52 59 description="List information of all vehicles", 53 60 enabled='True' … … 63 70 resource='vehicle' 64 71 table=module+'_'+resource 65 db.define_table(table, 66 SQLField('modified_on','datetime',default=now), 67 SQLField('uuid',length=64,default=uuid.uuid4()), 72 db.define_table(table,timestamp,uuidstamp, 68 73 SQLField('name')) 69 db['%s' % table].represent=lambda table:shn_list_item(table,resource='vehicle',action='display') 74 exec("s3.crud_fields.%s=['name']" % table) 75 db[table].exposes=s3.crud_fields[table] 76 db[table].uuid.requires=IS_NOT_IN_DB(db,'%s.uuid' % table) 70 77 db.veh_vehicle.name.requires=IS_NOT_EMPTY() 71 78 db.veh_vehicle.name.comment=SPAN("*",_class="req") … … 78 85 title_list=T('List Vehicles') 79 86 title_update=T('Edit Vehicle') 87 title_search=T('Search Vehicles') 80 88 subtitle_create=T('Add New Vehicle') 81 89 subtitle_list=T('Vehicles') … … 86 94 msg_record_deleted=T('Vehicle deleted') 87 95 msg_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)96 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)' % table) 89 97 }}} 90 98 … … 115 123 Add HTML templates for any custom functions: {{{/views/module/function.html}}} 116 124 117 NB Only {{{index.html}}} is required to start with since the RESTful controller re-uses standard views 125 NB Only {{{index.html}}} is required to start with since the RESTful controller normally re-uses standard views.[[BR]] 126 If Custom Views are wanted they are detected automatically if files are found in {{{/views/module/resource_method.html}}} 118 127 119 128 DeveloperGuidelines