I've added a new table to my Web2Py app:
db.define_table('users',
db.Field('name', 'string'),
db.Field('password', 'password'),
db.Field('reputation', 'integer', default=0),
db.Field('joined', 'datetime', default=datetime.utcnow())
)
And a field to an older table referencing it:
db.Field('user', db.users),
But this is giving me a KeyError
with the following Traceback:
Traceback (most recent call last):
File "E:\Programming\Python\web2py\gluon\restricted.py", line 204, in restricted
exec ccode in environment
File "E:/Programming/Python/web2py/applications/vote_up/models/db.py", line 85, in <module>
db.Field('user', db.users),
File "E:\Programming\Python\web2py\gluon\dal.py", line 5119, in __getattr__
return self[key]
File "E:\Programming\Python\web2py\gluon\dal.py", line 5113, in __getitem__
return dict.__getitem__(self, str(key))
KeyError: 'users'
How can I fix this?