Hi guys,
I have 2 tables defined Auth_User(PK=id) and Companies(PK=ID)
I also defined User_Has_Companies which has 2 columns USER_ID and COMP_ID
together should form a PK.
*db.py:*
*db.define_table('t_user_has_companies',*
* Field('first_name', 'reference auth_user', label='User',
writable=True, readable=True, notnull=True, required=True, ondelete='NO
ACTION', requires=IS_IN_DB(db, db.auth_user, '%(id)s %(first_name)s
%(last_name)s')),*
* Field('f_coname', 'reference t_companies',
label='Company', writable=True, readable=True, notnull=True, required=True,
ondelete='NO ACTION', requires=IS_IN_DB(db, db.t_companies, '%(id)s
%(f_coname)s'))*
* )*
*db.t_user_has_companies.first_name.requires=IS_NOT_IN_DB(db(db.t_user_has_companies.f_coname==request.vars.f_coname),db.t_user_has_companies.first_name)*
*In default.py:*
*@auth.requires_login()*
*def usercompanies():*
* grid=SQLFORM.grid(db.t_user_has_companies)*
* return locals()*
it works fine but the problem is i only get one drop down for the
companies, as for the User it appears a text box. How this one also be set
to drop down box?
Thanks
--
*This e-mail is confidential and may also be privileged. If you are not the
intended **recipient, please notify the sender immediately, delete it from
your system and do **not copy, disseminate, distribute or disclose any
information contained therein.*
--
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.