replace

IS_IN_DB(db_region(*db_region.post.state_id==db_region.county.state_id*)

with

IS_IN_DB(db_region(*db_region.post.state_id==request.vars.state_id*)

On Saturday, 26 March 2016 12:24:52 UTC-5, lucas wrote:
>
> hello one and all,
>
> ok, under the DAL model, say i have a county and zip code table, like, as 
> defined as:
>
> db_region.define_table('county',
>     Field('country_id', db_region.country, requires=IS_IN_DB(db_region, 
> db_region.country.id, '%(country)s'), writable=False, readable=False),
>     Field('state_id', db_region.state, requires=IS_IN_DB(db_region, 
> db_region.state.id, '%(state)s'), writable=False, readable=False),
>     Field('county', length=64, requires=NE, comment='county'),
> ...
>
> and
>
> db_region.define_table('post',
>     Field('country_id', db_region.country, requires=IS_IN_DB(db_region, 
> db_region.country.id, '%(country)s'), writable=False, readable=False),
>     Field('state_id', db_region.state, requires=IS_IN_DB(db_region, 
> db_region.state.id, '%(state)s'), writable=False, readable=False),
>     Field('county_id', db_region.county, requires=IS_IN_DB(db_region(
> *db_region.post.state_id==db_region.county.state_id*), db_region.county.id, 
> '%(county)s'), comment='county'),
>     Field('city', length=64, requires=NE, comment='city'),
>     Field('post', length=11, requires=NE, comment='zip or postal code'),
> ...
>
> see what i am trying to do in the bold?  i am trying to limit the counties 
> listed in the subsequent SQLFORM select/options to only those counties that 
> are in the state.
>
> when i try to compile i get an error, specifically an AttributeError.  any 
> suggestions?  thanx in advance, lucas
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to