If you benefit from web2py hope you feel encouraged to pay it forward by contributing back to society in whatever form you choose!
Hello slicers,
 
I'm quite new in Web2Py ;-)
 
here is my model:
db.define_table('company',
    Field('name', notnull=True, unique=True))

db.define_table('contact',
    Field('firstname', notnull=True),
    Field('lastname', notnull=True),
    Field('company', 'reference company'))

db.define_table('project',
    Field('name', notnull=True, unique=True),
    Field('description', 'text'),
    Field('company', 'reference company'))

db.define_table('log',
    Field('body', 'text',notnull=True),
    Field('project', 'reference project'),
    Field('contact', 'reference contact'))
 
 
and my controller:
 
def log_create():
    db.log.project.default = request.args(0)
    db.log.project.readable = False
    db.log.project.writable = False
    form = crud.create(db.log, next='logs')
    return locals()
 
My problem is when I create a log I get ALL the contacts.
What I would like is to get ONLY the contacts that belongs to the company of the project.
 
Can somebody help me?

Answers (0)

Comments (0)

Related content


Hosting graciously provided by:
Python Anywhere