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-Reference-and-Aliases>,
perhaps we could add a line or three in the manual section to explicitly
mention forward references, and not only self references.