You can achieve the expected result using computed fields.

db.define_table("state"...., Field("namecountryid"))

db.state.namecountryid.compute = lambda row: str(row.country_id)+row.name

db.state.requires = IS_NOT_IN_DB(....)

Also, You can use validators for that, but you will need to do some selects
inside the custom validators.

*Bruno Cezar Rocha*

http://www.CursoDePython.com.br
[image: Facebook] <http://facebook.com/rochacbruno> [image:
Twitter]<http://twitter.com/rochacbruno> [image:
LinkedIn] <http://linkedin.com/in/rochacbruno> [image:
about.me]<http://about.me/rochacbruno> [image:
Amazon] <http://amazon.com/author/rochacbruno> [image:
AngelList]<http://angel.co/rochacbruno> [image:
Blog RSS] <http://www.web2pyslices.com/slice/list.rss?author=1> [image:
Facebook Page] <http://facebook.com/CursoDePython> [image:
foursquare]<http://foursquare.com/rochacbruno> [image:
Google Plus] <https://plus.google.com/u/0/116110204708544946953/posts> [image:
pinterest] <http://pinterest.com/rochacbruno> [image:
SlideShare]<http://slideshare.com/rochacbruno> [image:
YouTube] <http://youtube.com/user/brunovegan>
 [image: Google Talk] rochacbruno [image: Skype] blouweb
Blog: Updated: uwsgi + nginx script for Ubuntu
11.10<http://www.web2pyslices.com/slice/show/1495/updated-uwsgi-nginx-script-for-ubuntu-1110>
  Want a signature like mine?
<http://r1.wisestamp.com/r/landing?promo=16&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_16>
Click
here.<http://r1.wisestamp.com/r/landing?promo=16&dest=http%3A%2F%2Fwww.wisestamp.com%2Femail-install%3Futm_source%3Dextension%26utm_medium%3Demail%26utm_campaign%3Dpromo_16>



On Mon, Jun 11, 2012 at 2:08 PM, Anthony <abasta...@gmail.com> 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
>

Reply via email to