There are two problems in the following codeL db.define_table('state', Field('country_id', db.country), Field('name', unique=True), # Field('full_name',compute=lambda row: row.country_id, unique=True), format = '%(name)s') #db(db.country.id==r['country_id']).select().first().name #class StateVirtualFields(object): # def namecountryid(self): # return str(self.state.country_id)+self.state.name #db.state.virtualfields.append(StateVirtualFields())
#db.state.full_name = Field.Virtual(lambda row: row.country_id) db.state.fullname.compute = lambda row: str(row.country_id)+row.name 1. db.state.fullname.compute doesnot work at all. 2. if I use Field('full_name',compute=lambda row: row.country_id, unique=True), for some reason it does *NOT* access country_id properly. Please Help. Regards. Suresh On Monday, June 11, 2012 10:38:48 PM UTC+5:30, Anthony wrote: > > db.state.namecountryid.requires = IS_NOT_IN_DB(db, db.state.namecountryid) >> > > Virtual fields are not for doing inserts/updates and therefore do not take > validators. > > Anthony >