Guys,
i changed the way of implementing the composite key, now i'm concatenating
both fields into 1.
*db.define_table('t_user_has_companies',*
* Field('unikey', notnull=True,required=True, compute=lambda
r: str(r.USER_ID) + str(r.COMP_ID)),*
* Field('USER_ID','reference
auth_user',label='User',writable=True,readable=True,notnull=True,required=True,ondelete='NO
ACTION'),*
* Field('COMP_ID','integer','reference
t_companies',label='Company',writable=True,readable=True,required=True,ondelete='NO
ACTION', requires=IS_IN_DB(db, db.t_companies, '%(id)s %(f_coname)s'))*
* )*
*db.t_user_has_companies.unikey.requires = IS_NOT_IN_DB(db,
't_user_has_companies.unikey')*
But it's still allowing me to add duplicate concatenations. this is so
weird.
Help please!!!
--
*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.