Hi trying to check true false in a string set, but does not work
## db.py
db.define_table('answer',
Field('description'),
Field('is_correct', type='list:string'),
Field('belongs_to_quiz',type='reference quiz',writable=False),
)
db.answer.is_correct.requires=IS_IN_SET(('y','n'))
## controller
def check_if_correct_answer():
"""this function tests if the user answers correctly to a question and
sends back a ajax response """
lesson = db.lesson(request.vars['lesson'])
answer = db.answer(request.vars.answer)
if answer.is_correct == "y":
#db.user_answer.insert(belongs_to_user=auth.user.id,
belongs_to_lesson=lesson.id, correct='y')
correct_or_not='y'
else:
correct_or_not='n'
return "jQuery('.flash').html('%s').slideDown();" % (correct_or_not)
But this test with answer.is_correct does not work. Anybody has an idea on
how to check?
--
---
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/groups/opt_out.