from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class screenSize(Page): form_model = 'player' form_fields = ['screen_width_hidden', 'screen_height_hidden',] class Consent(Page): form_model = 'player' form_fields = ['gave_consent'] class Consent_MTurk(Page): form_model = 'player' form_fields = ['mTurk_id', 'proceed_to_study',] def is_displayed(self): return self.player.gave_consent is True ## Throw error message only when Button to proceed to study is clicked without MTurk Id given def error_message(self, values): if values['mTurk_id'] is None and values['proceed_to_study'] is True: return 'Please enter your MTurk Worker Id' class NoConsent(Page): form_model = 'player' form_fields = ['why_no_consent', ] def is_displayed(self): return self.player.gave_consent is False or self.player.proceed_to_study is False class NoConsent_Bye(Page): def is_displayed(self): return self.player.gave_consent is False or self.player.proceed_to_study is False page_sequence = [screenSize, Consent, Consent_MTurk, NoConsent, NoConsent_Bye,]