Hi everyone, I am an undergrad at UCSC taking a web development course taught in web2py. I am working on a quarter long project that is a very watered down version of SurveyMonkey where a user can create surveys and have other people take them. I seem to be having trouble with referencing a table as a field in another table when I try to create a form when I try to add a question to my survey.
Here is the error: 1. 2. 3. 4. 5. 6. 7. 8. 9. Traceback (most recent call last): File "/Applications/web2py.app/Contents/Resources/gluon/restricted.py", line 224, in restricted File "/Applications/web2py.app/Contents/Resources/applications/QuizChimp/controllers/default.py" <http://127.0.0.1:8000/admin/default/edit/QuizChimp/controllers/default.py>, line 131, in <module> File "/Applications/web2py.app/Contents/Resources/gluon/globals.py", line 392, in <lambda> File "/Applications/web2py.app/Contents/Resources/applications/QuizChimp/controllers/default.py" <http://127.0.0.1:8000/admin/default/edit/QuizChimp/controllers/default.py>, line 22, in add_q File "/Applications/web2py.app/Contents/Resources/gluon/sqlhtml.py", line 1176, in __init__ File "/Applications/web2py.app/Contents/Resources/gluon/dal.py", line 9110, in __getitem__ AttributeError: 'Table' object has no attribute 'question_type' the function in default.py def add_q(): db.questions.survey.default = request.args(0) db.questions.survey.writable = False form = SQLFORM(db.questions,db.responses) survey = request.args(0) if form.process().accepted: redirect(URL('default', 'add_ans', [id])) session.flash = 'Your question has been added.' return dict(form=form, survey=survey) the tables used in my model file survey.py db.define_table('q_type', Field('type', 'string')) db.define_table('questions', Field('question', 'string'), Field('question_type', 'reference q_type', requires=IS_IN_DB(db, db.q_type, '%(type)s')), Field('survey', 'reference surveys'), Field('author', default = get_email())) db.questions.question.requires = IS_NOT_EMPTY() db.questions.author.label = 'Author' db.questions.author.writable = False db.questions.author.distinct = True db.questions.author.requires = IS_NOT_EMPTY() db.questions.author.requires = IS_EMAIL() the add_q.html page (very basic) {{extend 'layout.html'}} <h1>Add a question</h1> {{=BEAUTIFY(response._vars)}} I hope someone can help. Thanks, Michael -- 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.

