from otree.api import * import numpy as np import random c = cu doc = 'Introduction to the experiment' class Constants(BaseConstants): name_in_url = 'introduction' players_per_group = None num_rounds=1 class Subsession(BaseSubsession): pass #In the first subsession, participants in a group get assigned the categorical or flexible treatment #the data field is stored on the participant level as creating_session is executed at every subsession def creating_session(subsession): pass class Group(BaseGroup): pass class Player(BasePlayer): consent_given = models.BooleanField(label='Do you consent', Choices=[ [0, 'No'], [1, 'Yes'],]) class Introduction(Page): #Consent page form_model = 'player' class Consent(Page): #Consent page form_model = 'player' form_fields=['consent_given'] class NoConsent(Page): #Consent page form_model = 'player' form_fields=['consent_given'] @staticmethod def is_displayed(player): return player.consent_given == 0 class NoConsentEnd(Page): #Consent page form_model = 'player' @staticmethod def is_displayed(player): return player.consent_given == 0 page_sequence = [Introduction, Consent, NoConsent, NoConsentEnd]