h!
i got 2 tables, i need to make one update form for both, let's say they are:
---------
db.define_table("item",
...
Field('keywords', 'list:string', ...)
...
)
db.define_table('concrete_item',
Field('item_id', 'reference item'),
...
)
---------
In the controller:
---------
def edit():
item = db.item(request.args(0))
concrete_item = db.concrete_item(item_id=item.id)
fields = []
for f in item:
fields.append(f)
for f in concrete_item:
fields.append(f)
form = SQLFORM.factory(*fields)
# put values to form fields
for f in db.item:
form.vas[f.name] = item[f.name]
for f in db.concrete_item:
form.vas[f.name] = concrete_item[f.name]
if form.proccess().accepted:
# here call update_record, etc.
pass
return dict(form=form)
---------
The problem is with the
keywords field, when the form is rendered in the view it don't show the current value for the field. Meanwhile if i just make the update form for only one table:
--------