db.define_table('test_dept',
                SQLField('name'),
                SQLField('parent','reference test_dept')


On Feb 28, 8:26 am, 姚国荣 <[email protected]> wrote:
> db.define_table('test_dept',
>                SQLField('name'),
>                SQLField('parent',db.test_dept)
>        )
>
> Error log:
>
> Traceback (most recent call last):
>  File "F:\Develop\Python\Web2Py\web2py_src\web2py\gluon
> \restricted.py",
> line 98, in restricted
>    exec ccode in environment
>  File "F:/Develop/Python/Web2Py/web2py_src/web2py/applications/cas/
> models/db.py",
> line 17, in <module>
>    SQLField('parent',db.cas_dept)
>  File "F:\Develop\Python\Web2Py\web2py_src\web2py\gluon\sql.py", line
> 440, in __getattr__
>    return self[key]
>  File "F:\Develop\Python\Web2Py\web2py_src\web2py\gluon\sql.py", line
> 434, in __getitem__
>    return dict.__getitem__(self, str(key))
> KeyError: 'test_dept'
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to