from otree.api import * import time doc = """ Introduction """ class C(BaseConstants): NAME_IN_URL = 'survey' PLAYERS_PER_GROUP = 2 NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): is_dropout = models.BooleanField(initial=False) age = models.IntegerField(label='What is your age?', min=13, max=125) gender = models.StringField( choices=[['Male', 'Male'], ['Female', 'Female'], ['Other', 'Other']], label='What is your gender?', widget=widgets.RadioSelect, ) education = models.StringField( choices=['Primary School', 'Secondary School', 'High School', 'College/University', 'Masters Degree', 'Doctoral Degree'], label='What is your highest level of education?', widget=widgets.RadioSelect, ) employment = models.StringField( label="What is your employment status?", choices=["Student", "Student and Part-Time Employed", "Unemployed", "Retired", "Full-Time Employed", "Part-Time Employed", ], widget=widgets.RadioSelect ) class Introduction(Page): timeout_seconds = 180 @staticmethod def before_next_page(player: Player, timeout_happened): # note: bugfix if timeout_happened: player.is_dropout = True class drop(Page): @staticmethod def is_displayed(player: Player): return player.is_dropout #class Introduction2(Page): #timeout_seconds = 75 class Demographics(Page): form_model = 'player' form_fields = ['age', 'gender', 'education', 'employment'] timeout_seconds = 75 #page_sequence = [Introduction, drop, Demographics, Introduction2] page_sequence = [Introduction, drop, Demographics]