from otree.api import * from otree.models import player import random doc = """ Introduction """ class C(BaseConstants): NAME_IN_URL = 'introduction' NUM_ROUNDS = 1 PLAYERS_PER_GROUP = None class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): # Variable that keeps track of each participant's language preference. language = models.StringField( choices=[['de', 'Deutsch'], ['en', 'English']], widget=widgets.RadioSelect ) # PAGES class LanguageSelection(Page): """This page is for selecting which language to use""" form_model = 'player' form_fields = ['language'] @staticmethod # Before players continue to the next page, their preferred language is set. def before_next_page(player, timeout_happened): player.participant.language = player.language class Introduction(Page): pass class DataPrivacyInformation(Page): pass page_sequence = [ LanguageSelection, Introduction, DataPrivacyInformation, ]