from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'demographics' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): age = models.IntegerField( label = "Please enter your age in years.", min=0, max=100 ) gender = models.StringField( label = "Please select your gender.", choices = [["Female","Female"],["Male","Male"],["Non-Binary","Non-Binary"],["Do not want to disclose", "Do not want to disclose"]] ) studyfield = models.StringField( label = "Please name your field of study." ) statistic = models.IntegerField( label = "How do you rate your statistical skill compared to the general public?", widget = widgets.RadioSelectHorizontal, choices = [[1, "1 (very bad)"], [2, "2"], [3, "3"], [4, "4"],[5, "5"],[6, "6"], [7, "7 (very good)"]] ) riskaversion = models.IntegerField( label="In general, how willing are you to take financial risks?", widget=widgets.RadioSelectHorizontal, choices=[[1, "1 (not at all willing)"], [2, "2"], [3, "3"], [4, "4"], [5, "5"], [6, "6"], [7, "7 (very willing)"]] ) feedback = models.BooleanField( label="Would you like to see the drawn likelihoods of a price increase for your price paths before proceeding with the short survey?" ) comments = models.StringField( label = "Would you like to comment on the study?", blank = True, ) treatment = models.StringField() # PAGES class endexperiment(Page): pass class demographics(Page): form_model = "player" form_fields = ["age","gender","statistic","riskaversion", "comments"] class completioncode(Page): form_model = "player" @staticmethod def vars_for_template(player): participant=player.participant bonusamount=participant.Bonus*0.30 return dict( bonusamount=round(bonusamount,2), ) page_sequence = [endexperiment, demographics, completioncode]