Hello,
I would use a single form for different table that has relation. The problem
it that those table are really similar. What should I do to avoid this
problem? Is it possible?
Here the model
db.define_table('client',
Field('name'),
Field('title'),
Field('date','date'))
db.define_table('address',
Field('client',db.client,writable=False,readable=False),
Field('street'),
Field('city'),
Field('title'),
Field('date','date'))
Controller :
def register():
form=SQLFORM.factory(db.client,db.address)
if form.accepts(request.vars):
id = db.client.insert(**db.client._filter_fields(form.vars))
form.vars.client=id
id = db.address.insert(**db.address._filter_fields(form.vars))
response.flash='Thanks for filling the form'
return dict(form=form)
What does : _filter_fields(form.vars)
Does it get id value only or all the fields value store in form.vars?
Richard