| from os import path
db.define_table('carousel',
Field('is_enabled', 'boolean', readable=True, writable=True, default=True, label=T('Is Enabled')),
# Field('page', 'reference page', label=T('Page')),
Field('name', 'string',length=256, notnull=True, label=T('Name')),
Field('alt', 'string', length=256, label=T('Alt')),
Field('description', 'string', length=512, label=T('Description')),
Field('is_url', 'boolean', readable=True, writable=True, default=False, label=T('Is Url')),
Field('url', 'string', length=256,label=T('Url')),
Field('image_file', 'upload', uploadfolder=path.join(
request.folder,'static','images','carousel'
), autodelete=True, label=T('Image File')),
Field('created_on','datetime',default=request.now,
writable=False,readable=False, label=T('Created on')),
format='%(name)s'
)
#db.carousel.page.requires = IS_EMPTY_OR(IS_IN_DB(db, db.page.id, '%(title)s', zero=T('<Empty>'))) |