Thanks pbreit, but they are not virtual fields, they are just based on
another field definition.

Maybe with a function:

def like(field, name):
  import copy
  f = copy.copy(field)
  f.name = name
  f.label = ' '.join(x..capitalize() for x in name.split('_'))
  return f

name = Field('name','string',length=20,requires=IS_NOT_EMPTY())
db.define_table('person',
  like(name, 'firstname'),
  like(name, 'lastname'),
  Field('age', 'integer'),
  ...

On Aug 23, 8:36 pm, pbreit <pbreitenb...@gmail.com> wrote:
> Virtual Fields?http://www.web2py.com/book/default/chapter/06#Virtual-Fields

Reply via email to