Web2py, Database Relationships And Permissions
So i've this problem i've 2 tables for example templates(id,user_id,template_name,reference) user_settings(id,user_id,default_template) so each user can create many templates and i
Solution 1:
First, shouldn't
Field('standard_template_id', templates,
be
Field('standard_template_id', db.i2l_templates,
For a reference field, the default form validator is IS_IN_DB(db,'<table>.id')
, which will select all records in the referenced table. However, you can override the default validator and specify a subset of records:
requires = IS_IN_DB(db(db.i2l_templates.id==auth.user_id),
'i2l_templates.id', '%(template_name)s')
See here for more on database validators.
Post a Comment for "Web2py, Database Relationships And Permissions"