from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Consent(Page): form_model = 'player' form_fields = ['consent'] # this means player.consent def error_message(self, code): if code not in [{'consent': 'I consent'}, {'consent': "I Consent"}, {'consent': "I consent."}]: return 'Either you have misspelled "I consent" or you do not wish to give your consent. ' \ 'Please raise your hand' pass class ParticipantCode(Page): form_model = 'player' form_fields = ['participant_code'] def error_message(self, code): if code not in [{'participant_code': 'mk2rtz'}, {'participant_code': "rl3knp"}]: return 'The participant code is not valid. Please review it.' def before_next_page(self): if self.player.participant_code == 'mk2rtz': self.participant.vars['gender'] = 'Female' else: self.participant.vars['gender'] = 'Male' pass class Presentation(Page): def vars_for_template(self): return {'image_path': 'start_knowledge/nyse.jpg'} pass page_sequence = [ Consent, ParticipantCode, Presentation ]