I have created a *factory,department,section and team* table in the 
database 
and a *factory* is on a *one to many* relationship with *department*
a *department* is on a *one to many* relationship with* section*
a *section* is on a *one to many* relationship with* team*
 
*Table names*
factory = portal_factory
department = portal_department
section = portal_section
team = portal_team
 
*db.py codes*
## *Factory*
db.define_table('portal_factory',
Field('name', notnull=True , required=True,unique=True)
)
## *Department*
db.define_table('portal_department',
Field('factory_id',db.portal_factory,notnull=True,required=True,requires=IS_IN_DB(db,db.portal_factory.id,'%(name)s')),
Field('name',notnull=True,required=True,unique=True)
)
## *Section*
db.define_table('portal_section',
Field('department_id',db.portal_department,notnull=True,required=True,requires=IS_IN_DB(db,db.portal_department.id,'%(name)s')),
Field('name', notnull=True, required=True, unique=True),
)
## *Team*
db.define_table('portal_team',
Field('section_id',db.portal_section,notnull=True,required=True,requires=IS_IN_DB(db,db.portal_section.id,'%(name)s')),
Field('name', notnull=True, required=True, unique=True),
)
 
## This is the tricky part  
##i want to dynamically make an option list in the *t_department based on 
the selected t_factory*
##i want to dynamically make an option list in the* t_section based on the 
selected t_department*
##i want to dynamically make an option list in the* t_team based on the 
selected t_section*
 
## Extra fields on auth_user for registration 
auth.settings.extra_fields['auth_user']=[
Field('t_factory','reference portal_factory',label='Factory',notnull = 
True,required = True,requires=IS_IN_DB(db, 
db.portal_factory.id,'%(name)s')),
Field('t_department','reference 
portal_department',label='Department',notnull = True,required = 
True,requires=IS_IN_DB(db, db.portal_department.id,'%(name)s')),
Field('t_section','reference portal_section',label='Section',notnull = 
True,required = True,requires=IS_IN_DB(db, 
db.portal_section.id,'%(name)s')),
Field('t_team','reference portal_team',label='Team',notnull = True,required 
= True,requires=IS_IN_DB(db, db.portal_team.id,'%(name)s')),
]
 
i have an attached file where this what i want to happen upon registration
 
Upon registration if i select *factory* *A *there are different *department 
*selections in the dropdown (dropdown.png)
same as if i select *factory B *there are different *department *selections 
in the dropdown (dropdown2.png)
this setup will just follow for *department *to *section *and *section *to 
*team*
 
Thank you in advance for your help...More power to web2py
 
 

-- 
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