Version 2 (modified by Fran Boon, 3 years ago) ( diff )

Link to full docs on custom controllers

Custom Tables

Templates can define their own custom nodels without needing to touch the core code. tablename should be "custom_%s" % resourcename

Add a dict (or OrderedDict if want to manage dependency order), like:

settings.models = {tablename: function}

The called function would look something like:

def define_custom_test(db, tablename):

   from gluon import Field

   table = db.define_table(tablename,

   return table

If wanting to have a REST controller for them, then see S3/S3REST/s3_rest_controller i.e. add "custom" to settings.modules and add an entry to the rest_controllers:

settings.base.rest_controllers = {("custom", resourcename): ("custom", resourcename)}
Note: See TracWiki for help on using the wiki.