I'm trying to do something like this: TEXT = 'text' RADIO = 'radio' SELECT = 'select'
QUESTION_TYPES = ( (TEXT, 'text'), (RADIO, 'radio'), (SELECT, 'checkboxes'),) def get_choice(): choices = choices.split(',') choices_list = [] for c in choices: c = c.strip() choices_list.append((c,c)) choices_tuple = tuple(choices_list) return choices_tuple db.define_table('survey', Field('name', unique=True), Field('created', 'datetime', default=request.now, writable=False), Field('is_active', 'boolean', default=False)) db.survey.name.requires = IS_NOT_IN_DB(db, db.survey.name) db.define_table('question', Field('survey', db.survey), Field('title', length=200), Field('created', 'datetime', default=request.now, writable=False), Field('question_type', default='text', widget=SQLFORM.widgets.radio. widget), Field('choices', 'text', default=get_choice()) ) db.question.survey.requires = IS_IN_DB(db, db.survey.id) db.question.question_type.requires = IS_IN_SET(QUESTION_TYPES)Enter code here... Now I need somehow to call get_choice() from db.question.choice to split radio and checkbox answers. Again: what I'm trying to accomplish is to set up a survey. I want to create a set of questions with appadmin which can include radio, checkboxes or text answers. P.S. I'm fairly new to python :) -- 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.