Reputation: 344
I would like to know why my variables in web2py SQLFORM.factory have a no_table_[name] instead of the actual table name? Is there anything missing code.
e.g
form = SQLFORM.factory(db.event, db.event_permissions, record=record, fields=fields, submit_button='Edit Event Master')
Upvotes: 0
Views: 727
Reputation: 25536
SQLFORM.factory
works by creating a dummy DAL
instance along with a dummy DAL
table. By default, the dummy table name is "no_table", but you can change that via the table_name
argument.
When you pass entire tables to SQLFORM.factory
, it simply extracts the fields from those tables, but it does not retain the table names when constructing the HTML widget id's (instead, it just uses the dummy table name to construct the id's). In the book section on One form for multiple tables, this is why it says:
This only works when the tables don't have field names in common.
If you have fields with the same names in both tables, they will end up with the same id's.
Upvotes: 1