Changes between Version 10 and Version 11 of DeveloperGuidelinesNewModule
- Timestamp:
- 01/02/09 02:09:15 (16 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelinesNewModule
v10 v11 11 11 12 12 This makes it visible on the front page & the left-hand navigation menu 13 14 13 15 14 Create a file {{{/models/module.py}}} … … 35 34 To avoid namespace clashes, use the format: {{{db.module_table}}} 36 35 37 === Controller === 38 Add CRUD functions for these tables to {{{/controllers/module.py}}} 36 Add a section for messages for your resources to {{{models/_db.py}}}: 37 {{{ 38 def shn_crud_strings_lookup(resource): 39 "Look up CRUD strings for a given resource." 40 elif resource=='shelter': 41 return Storage(title_create=T('Add Shelter'), 42 title_display=T('Organisation Details'), 43 title_list=T('List Shelters'), 44 title_update=T('Edit Shelter'), 45 subtitle_list=T('Shelters'), 46 subtitle_create=T('Add New Shelter'), 47 label_list_button=T('List Shelters'), 48 label_create_button=T('Add Shelter'), 49 msg_record_created=T('Shelter added'), 50 msg_record_modified=T('Shelter updated'), 51 msg_record_deleted=T('Shelter deleted'), 52 msg_list_empty=T('No Shelters currently registered')) 53 }}} 39 54 40 The RESTful controller for a table needs just a few small tweaks once pasted: 41 * Search/Replace 'organisation' with your_resource 55 Copy/paste & do just a few small tweaks once pasted: 42 56 * Search/Replace 'Organisation' with Your_resource 43 57 * Fix plurals, if required (e.g. Persons -> People, Classs to Classes, Metadatas -> Metadata) 58 59 === Controller === 60 Add CRUD functions for these tables to {{{/controllers/module.py}}}: 61 {{{ 62 def shelter(): 63 "RESTful CRUD controller" 64 return shn_rest_controller(module,'shelter') 65 }}} 44 66 45 67 Manual method for if/when you need more control: DeveloperGuidelinesCreateReadUpdateDelete