On Tuesday, December 9, 2014 1:13:06 PM UTC-8, Michael Howard wrote:
>
> 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.
> [...]
> 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()
>
>
> Where do you get q_type and surveys from? You show them as a reference,
do you have tables for them?
/dps
--
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.