from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Pre_A_Dem(Page): form_model = 'player' form_fields = [ 'yearbirth', 'quarterbirth', 'female', 'ethnicity', 'other_ethnicity', 'educ', 'income', 'residence_state', 'other_residence_state', 'grewup_country', 'other_grewup_country', 'grewup_state', 'other_grewup_state', 'fave_color', 'fave_beverage', ] def error_message(self,values): if values['ethnicity'] == 'OTHER' and type(values['other_ethnicity']) == type(None): return 'If you select \'other ethnic group\', you must specify in the provided field.' if values['residence_state'] == 'OTHER' and type(values['other_residence_state']) == type(None): return 'If you select \'other state\', you must specify in the provided field.' if values['grewup_country'] == 'OTHER' and type(values['other_grewup_country']) == type(None): return 'If you select \'other country\', you must specify in the provided field.' if values['grewup_state'] == 'OTHER' and type(values['other_grewup_state']) == type(None): return 'If you select \'other state\', you must specify in the provided field.' page_sequence = [Pre_A_Dem]