*I figured it out. I needed to add this validator:* db.inbite.parent.requires = IS_EMPTY_OR(IS_IN_DB(db, 'inbite.id', zero='None'))
Otherwise the appadmin insert was inserting rows with parent=0, thus introducing a reference to a non-existent row. This also happens with the Web2Py book example for self-reference (person table with father and mother) - note: inserts via the CLI (like in the book) do not cause problems in the appadmin query page - only when a row is inserted via the appadmin interface with a default, blank self-reference field Is there a better method for adding a self-referential field that can point to nothing? *Now I get a new error when I click the 'None' reference. This is not such a big deal, though:* ValueError: invalid literal for int() with base 10: 'None' John On Fri, Dec 10, 2010 at 8:08 AM, Ivan Matveev <[email protected]> wrote: > Your code works on my 3 weeks old web2py and MySQL. > I can insert/view the table with db admin. >

