Hi -
I created a custom auth_user table with a new field ('company') and am
having trouble accessing it in my controller:
db.py
db.define_table(
auth.settings.table_user_name,
Field('first_name', length=128, default=''),
Field('last_name', length=128, default=''),
Field('email', length=128, default='', unique=True,
label='Company Email'),
Field('password', 'password', length=512, readable=False),
Field('company', length=128, label='Company Name'),
Field('registration_key', length=512, default='',
writable=False, readable=False),
Field('reset_password_key', length=512, default='',
writable=False, readable=False),
Field('first_name', length=128, default=''),
Field('registration_id', length=512, writable=False,
readable=False, default=''), format='%(first_name)s %(last_name)s',
)
default.py
db.tokens.insert(token = token,
first_name = request.post_vars.first,
last_name = request.post_vars.last,
email = request.post_vars.email,
company = db.auth_user.company)
Produces an error:
Traceback (most recent call last):
File "/media/sf_VBoxWeb2py/web2py/gluon/restricted.py", line 227, in
restricted
exec ccode in environment
File
"/media/sf_VBoxWeb2py/web2py/applications/nolabills/controllers/default.py"
<https://192.168.56.101:8000/admin/default/edit/nolabills/controllers/default.py>,
line 239, in <module>
File "/media/sf_VBoxWeb2py/web2py/gluon/globals.py", line 417, in <lambda>
self._caller = lambda f: f()
File "/media/sf_VBoxWeb2py/web2py/gluon/tools.py", line 4250, in f
return action(*a, **b)
File
"/media/sf_VBoxWeb2py/web2py/applications/nolabills/controllers/default.py"
<https://192.168.56.101:8000/admin/default/edit/nolabills/controllers/default.py>,
line 119, in dashboard
company = db.auth_user.company)
File "/media/sf_VBoxWeb2py/web2py/gluon/packages/dal/pydal/objects.py", line
726, in insert
ret = self._db._adapter.insert(self, self._listify(fields))
File "/media/sf_VBoxWeb2py/web2py/gluon/packages/dal/pydal/adapters/base.py",
line 746, in insert
raise e
OperationalError: no such column: auth_user.company
I'm new to web2py and struggling to understand how to remedy it. I gather
it's something to do with migrations, but simply setting migrate = True in
define_table is not solving the issue.
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.