| from os import path
db.define_table('file',
Field('name', 'string', label=T('File Name')),
Field('website_url','string', length="512", label=T('Source Link')),
Field('table_name',readable=False, writable=False),
Field('record_id','integer',readable=False, writable=False),
Field('title', label=T('Title'), notnull=True),
Field('comment', label=T('Comment')),
Field('version','string', length="32", label=T('Version Number')),
Field('file', 'upload', autodelete=True, label=T('File')),
Field('size', 'double', readable=False, writable=False, label=T('Size')),
format='%(title)s'
)
db.file.size.compute = lambda row: path.getsize(path.join(request.folder,'uploads',row.file)) |