Changes between Version 51 and Version 52 of DeveloperGuidelinesNewModule
- Timestamp:
- 11/29/13 21:44:15 (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelinesNewModule
v51 v52 20 20 }}} 21 21 22 Add tables to modules/s3db/<MODULE NAME>.py file, as-required for your resources. 22 For each major "resource" in your module, add a class that is a subclass of S3Model. The class must define a model() method that defines the tables for that resource. The class can define multiple tables, for other resources associated with the major resource. For instance, if you have a major resource representing a vehicle, you might want a table to represent types of vehicles, so users can add new types without changing the code. The main table for specific vehicles and the table for types can go in the same model class. 23 23 24 To avoid namespace clashes, use your module name as a prefix for table names. 24 Follow with underscore and the name of the resource your table represents: module_resource. Resource names should be unique.25 Follow with underscore and the name of the resource your table represents: <MODULE NAME>_<RESOURCE>. Resource names should be unique. 25 26 26 27 E.g. if building a Vehicle Management System, create s3db.vms_vehicle: