See http://stackoverflow.com/a/8152910/440323


On Thursday, February 9, 2012 7:53:27 PM UTC-5, shartha wrote:
>
> Let's say the model has three tables, called country, cities and 
> customers that are defined like: 
>
> db.define_table('continents', 
>    Field('name'), 
> ) 
>
> db.define_table('countries', 
>    Field('name'), 
>    Field('continent', db.continents), 
> ) 
>
> db.define_table('customers', 
>    Field('name'), 
>    Field('country', db.countries), 
>    Field('continent', db.continents), 
> ) 
>
> Now if I check the "Database Administration", how can I set up the 
> customers table such that when  I am inserting a record in the 
> customers table, if I select a country, the continent the country is 
> in is automatically selected? 
>
> Under another scenario, imagine we first select the continent, then 
> the country and then enter the name of the customer, how can I set up 
> the model such that when the continent is selected, only the countries 
> in that particular continent are available to be selected? 
>
> I am imagining that the counties and continents in the customers table 
> and the countries table are drop-down menus. 
>
> Any help would be appreciated. Thanks! =)

Reply via email to