Custom Tables
Templates can define their own custom models without needing to touch the core code.
- Create a file with S3Model(s) in, just as if it was going into
s3db/
although change the s3 import path tofrom s3 import *
- Add this to
mytemplate/__init__.py
, e.g. for a module called 'custom':__all__ = ("custom", ) import templates.mytemplate.custom
- Add to
mytemplate/config.py
:settings.base.custom_models = {"custom": "mytemplate", } settings.modules["custom"] = {"name_nice": T("My Custom Module"), "module_type": 10}
- If wanting to have a REST controller for them, then see S3/S3REST/s3_rest_controller
i.e. add an entry to mytemplate/config.py
:
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.