Hi... I'm trying to create a grading system where I can reference the
questions_answered with the questions id.
I want to be able to load all of the questions from the first table and and
see whether or not the student got them right in the second. If the student
got them right I actually only want the title of the question and not the
question itself but I never made a reference to it in my
questions_answered. I do however have a "question" field in my
questions_answered which references the questions table. Is there a way for
me to pull the title as well?
db.define_table('questions',
Field('id','integer'),
Field('title','string'),
Field('question','text'),
Field('answer','string'),
migrate=False)
db.define_table('questions_answered',
Field('id','integer'),
Field('question', type='reference questions',
requires=IS_EMPTY_OR(IS_IN_DB(db,db.uct_challenge.id,"%(question)s")),represent=lambda
id, r: db.questions(id).question),
Field('submitted','string', writable=False),
Field('answered_by',db.auth_user),
Field('correct','boolean'),
format='%(name)s', migrate=True)
--
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.