Version 1 (modified by Fran Boon, 3 months ago) ( diff )

Custom Tables

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 also 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.