You can reference the table itself like this.
Try:
 db.define_table('table_example',
     SQLField('some_int_field','integer'),
     SQLField('parent_id_field', 'integer'))
and then treat parent_id_field just as it's name suggests

On Friday 12 June 2009 10:27:09 cpt1002 wrote:
> Hi,
>
> Has anyone gotten an error using the "reference table" call with
> similar model code:
>
> db.define_table('table_example',
>     SQLField('some_int_field','integer'),
>     SQLField('parent_id_field', 'reference table_example'))
>
>
> The error is:
>
> Traceback (most recent call last):
>   File "/home/web2py/gluon/restricted.py", line 107, in restricted
>     exec ccode in environment
>   File "/home/web2py/applications/cpt1002/models/db.py", line 82, in
> <module>
>     SQLField('parent','reference category'))
>   File "/home/web2py/gluon/sql.py", line 953, in define_table
>     else:
>   File "/home/web2py/gluon/sql.py", line 1143, in __init__
>     new_fields = [ SQLField('id', 'id') ]
> SyntaxError: SQLTable: table does not exist
>
>
>
> This worked before until I updated just this evening to Version 1.64.1
>
> Any help would be appreciated. Thanks!
>
> 


-- 
Sincerely yours
Alexey Nezhdanov

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to