from otree.api import * doc = """ Consent and study instructions for the Charity Navigator-style experiment. """ class C(BaseConstants): NAME_IN_URL = "consent_intro" PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 BONUS_ENDOWMENT = cu(3) class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): consent = models.BooleanField( choices=[ [True, "I consent to participate in this study."], [False, "I do not consent to participate."], ], widget=widgets.RadioSelect, label="", ) prolific_id = models.StringField(blank=True) class Consent(Page): form_model = "player" form_fields = ["consent"] @staticmethod def error_message(player: Player, values): if not values["consent"]: return "You must consent to participate in order to continue." @staticmethod def before_next_page(player: Player, timeout_happened): player.prolific_id = player.participant.label or "" class Disclaimer(Page): pass class Instructions(Page): @staticmethod def vars_for_template(player: Player): return dict(bonus_endowment=C.BONUS_ENDOWMENT) page_sequence = [Consent, Disclaimer, Instructions]