hello Massimo, here I use appadmin to insert records so no controller/function
another 'refuznik': db.define_table('person', Field('name', unique=True, requires=IS_NOT_IN_DB(db,'person.name')), Field('country'), Field('age','integer'), format='%(name)s') db.define_table('thing', Field('name'), Field('persona', 'reference person'), Field('personb', 'reference person')) db.thing.persona.requires = [IS_IN_DB(db, 'person.id', '%(name)s')] db.thing.personb.requires = [IS_IN_DB(db, 'person.id', '%(name)s')] <type 'exceptions.Exception'> Validation error, field:persona <gluon.validators.IS_IN_DB object at 0x7f835efd4350> Version web2py™ Version 2.12.3-stable+timestamp.2015.08.19.00.18.03 Traceback 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18. 19. 20. 21. 22. 23. 24. 25. 26. Traceback (most recent call last): File "/opt/web2py/gluon/restricted.py", line 227, in restricted exec ccode in environment File "/opt/web2py/applications/welcome/controllers/appadmin.py" <http://127.0.0.1:8000/admin/default/edit/welcome/controllers/appadmin.py>, line 703, in <module> File "/opt/web2py/gluon/globals.py", line 412, in <lambda> self._caller = lambda f: f() File "/opt/web2py/applications/welcome/controllers/appadmin.py" <http://127.0.0.1:8000/admin/default/edit/welcome/controllers/appadmin.py>, line 151, in insert if form.accepts(request.vars, session): File "/opt/web2py/gluon/sqlhtml.py", line 1495, in accepts **kwargs File "/opt/web2py/gluon/html.py", line 2119, in accepts status = self._traverse(status, hideerror) File "/opt/web2py/gluon/html.py", line 885, in _traverse newstatus = c._traverse(status, hideerror) and newstatus File "/opt/web2py/gluon/html.py", line 885, in _traverse newstatus = c._traverse(status, hideerror) and newstatus File "/opt/web2py/gluon/html.py", line 885, in _traverse newstatus = c._traverse(status, hideerror) and newstatus File "/opt/web2py/gluon/html.py", line 885, in _traverse newstatus = c._traverse(status, hideerror) and newstatus File "/opt/web2py/gluon/html.py", line 892, in _traverse newstatus = self._validate() File "/opt/web2py/gluon/html.py", line 1860, in _validate raise Exception(msg) Exception: Validation error, field:persona <gluon.validators.IS_IN_DB object at 0x7f835efd4350> -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.