from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class WelcomeBack(Page): form_model = 'player' form_fields = ['mturk_id'] def error_message(self, values): print('values is', values) if values['mturk_id'] not in Constants.a_players and values['mturk_id'] not in Constants.b_players: return 'Please enter the same MTurk ID you used for the first part yesterday.' class Instructions(Page): def before_next_page(self): if self.player.mturk_id in Constants.a_players: self.player.participant.vars['type'] = 'A' if self.player.mturk_id in Constants.b_players: self.player.participant.vars['type'] = 'B' self.player.participant.vars['treatment'] = 0 self.player.participant.vars['mturk_id'] = self.player.mturk_id import time self.participant.vars['wait_page_arrival'] = time.time() page_sequence = [WelcomeBack, Instructions]