In my models I have the following table definition:

db.define_table('node',
    Field('computedName',length=128),
    Field('computedSubClass',type='integer'),
    
Field('createdOn',type='datetime',default=request.now,requires=IS_DATETIME(format='%Y-%m-%d
 
%H:%M:%S'),writable=False,readable=False,represent = lambda v, row: 
v.strftime('%d/%m/%Y %H:%M:%S') if v else ''),
    
Field('modifiedOn',type='datetime',default=request.now,requires=IS_DATETIME(format='%Y-%m-%d
 
%H:%M:%S'),writable=False,readable=False,update=request.now,represent = 
lambda v, row: v.strftime('%d/%m/%Y %H:%M:%S') if v else ''),
    format='%(computedName)s',
    migrate=False)

Fields createdOn and modifiedOn have attributes that occur in other table 
definition as well, is it possible to move this:

type='datetime',default=request.now,requires=IS_DATETIME(format='%Y-%m-%d 
%H:%M:%S'),writable=False,readable=False,represent = lambda v, row: 
v.strftime('%d/%m/%Y %H:%M:%S') if v else ''

outside the field definition, and use it in field definitions named 
createdOn and modifiedOn (taken lazy_tables into account)


Kind regards,

Annet

-- 



Reply via email to