Hi Denes, Sounds like you are trying to define Domains, which are a good idea. Many modelling tools will allow you to define an attribute's properties by referencing a particular Domain. EG. a description domain might be VARCHAR(100), NULL, etc so all description fields linked to the Domain would be identical. Is your example showing a Field that can exist (as a definition at least) without a table ? If yes, then you could call it a Domain definition.
Sounds interesting. Andrew On Aug 24, 2:18 pm, DenesL <denes1...@yahoo.ca> wrote: > 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- Hide > > quoted text - > > - Show quoted text -