The problem happens in this requires
IS_NOT_IN_DB(db(db.companyapplication.application==request.vars.application),db.companyapplication.company,error_message='combination
of company en application already in database')]
because the field naming choice makes it impossible to tell apart in
request.vars which application is being referenced on each side of the
comparison, on the left side companyapplication.application refers to
an application.id while on the right side it refers to
application.application, a string.
to get around this redefine table companyapplication as follows
db.define_table('companyapplication',
Field('company_id',db.company,),
Field('application_id',db.application),
migrate=False)
and update the requires to reflect the new naming
db.companyapplication.company_id.requires=[IS_IN_DB(db,db.company.id,'%
(company)s'),
IS_NOT_IN_DB(db(db.companyapplication.application_id==request.vars.application_id),db.companyapplication.company_id,error_message='combination
of company and application already in database')]
db.companyapplication.application_id.requires=IS_IN_DB(db,db.application.id,'%
(application)s')
Following such a convention (adding '_id' to denote a reference) is
highly recommended.
Denes.
--
Subscription settings: http://groups.google.com/group/web2py/subscribe?hl=en