I have posted this query sometime ago via google-group's web interface -
but it did not appear in the list - may be it is lost or held in moderation
queue (This is my first post) So I am sending this again via normal gmail
interface.
If this is duplicate - please ignore.
================
I'm using web2py version : Version 2.0.0 (2012-07-26 06:06:10) dev
I have tables defined as follows :
name = db.Table(db, 'name',
Field('name', 'string', length=128, notnull=True, unique=True))
name_desc = db.Table(db, 'base',
name,
Field('description', 'text', default=''))
db.define_table('mother',
name_desc,
format='%(name)s')
db.define_table('father',
name_desc,
format='%(name)s')
db.define_table('child',
name_desc,
Field('mother', db.mother),
Field('father', db.father),
format='%(name)s')
*I am able to successfully insert data in "mother" table via script (e.g.
db.mother.insert(name="Alice"))*
But when I use appadmin to insert new record into mother table, I get the
following error :
I have a sqlform.grid somewhere in the app, I get same error there too ( I
think appadmin also uses sqlform.grid internally)
Traceback (most recent call last):
File "/home/mandar/web2py/gluon/restricted.py", line 205, in restricted
exec ccode in environment
File "/home/mandar/web2py/applications/test1/controllers/appadmin.py",
line 432, in <module>
File "/home/mandar/web2py/gluon/globals.py", line 182, in <lambda>
self._caller = lambda f: f()
File "/home/mandar/web2py/applications/test1/controllers/appadmin.py",
line 127, in insert
if form.accepts(request.vars, session):
File "/home/mandar/web2py/gluon/sqlhtml.py", line 1146, in accepts
hideerror=hideerror,
File "/home/mandar/web2py/gluon/html.py", line 1870, in accepts
status = self._traverse(status,hideerror)
File "/home/mandar/web2py/gluon/html.py", line 793, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
File "/home/mandar/web2py/gluon/html.py", line 793, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
File "/home/mandar/web2py/gluon/html.py", line 793, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
File "/home/mandar/web2py/gluon/html.py", line 793, in _traverse
newstatus = c._traverse(status,hideerror) and newstatus
File "/home/mandar/web2py/gluon/html.py", line 800, in _traverse
newstatus = self._validate()
File "/home/mandar/web2py/gluon/html.py", line 1625, in _validate
(value, errors) = validator(value)
File "/home/mandar/web2py/gluon/validators.py", line 554, in __call__
table = self.dbset.db[tablename]
File "/home/mandar/web2py/gluon/dal.py", line 6877, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'name'
Similarly, after populating mother/father and child tables via script when
I try to update "child" record - In the dropdown I see mother's names
instead of ID (as expected) but when I select different "mother" and submit
I get same error (traceback may be slightly different - but same
KeyError:'name' )
What is wrong with the table definitions ?
Thanks,
-Mandar
P.S: This may be similar to
https://groups.google.com/d/msg/web2py/XR4T92l2rJ4/dtTRnO0e7dcJ
--