Custom Tables

Templates can define their own custom models without needing to touch the core code.

  1. Create a file with S3Model(s) in, just as if it was going into s3db/ although change the s3 import path to from s3 import *
  1. Add this to mytemplate/, e.g. for a module called 'custom':
    __all__ = ("custom",
    import templates.mytemplate.custom
  1. Add to mytemplate/
    settings.base.custom_models = {"custom": "mytemplate",
    settings.modules["custom"] = {"name_nice": T("My Custom Module"), "module_type": 10}
  1. If wanting to have a REST controller for them, then see S3/S3REST/s3_rest_controller

i.e. add an entry to mytemplate/

settings.base.rest_controllers = {("custom", resourcename): ("custom", resourcename)}
Last modified 3 years ago Last modified on 09/13/21 15:52:31
Note: See TracWiki for help on using the wiki.