Jonathan, Thanks very much for you pointing out the reference keyword, that solves the problem for self-referencing tables, but do you know of a solution to my two-tables-referencing-each-other problem? I admit my simplistic alias example could be solved very elegantly by a self- referencing table, but I'd like to know how to do it with two tables, if I wanted.
Any thoughts? Thanks again On Aug 10, 7:16 pm, Jonathan Lundell <[email protected]> wrote: > On Aug 10, 2010, at 10:55 AM, Oatman wrote: > > > > > > > Hi all, > > > How do I create two tables that both refer to each other? Here's a > > simple example: > > > db.define_table( > > 'item', > > Field('current_alias', 'db.item_alias') > > ) > > > db.define_table( > > 'item_alias', > > Field('name'), > > Field('item', 'db.item') > > ) > > > This throws > > "SyntaxError: Field: unknown field type: db.item_alias for > > current_alias" > > because they both need the other to be created first! > > > How can I create a simple relationship like this? Thanks in advance! > > If the answer to this question is 'reference' > <http://web2py.com/book/default/chapter/06?search=define_table#Self-Re...>, > perhaps we could add a line or three in the manual section to explicitly > mention forward references, and not only self references.

