from otree.api import * import pandas as pd import random doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'eval' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 # Info = pd.read_csv('eval/example3.csv') CandiID = pd.read_csv('eval/num_order_5.csv') CandiR = pd.read_csv('eval/race_order_5.csv') InfoAF = pd.read_csv('eval/AsianFemale2.csv') InfoAM = pd.read_csv('eval/AsianMale2.csv') InfoBF = pd.read_csv('eval/BlackFemale2.csv') InfoBM = pd.read_csv('eval/BlackMale2.csv') InfoWF = pd.read_csv('eval/WhiteFemale2.csv') InfoWM = pd.read_csv('eval/WhiteMale2.csv') Info=[[pd.read_csv('eval/AsianFemale2.csv')], [pd.read_csv('eval/AsianMale2.csv')], [pd.read_csv('eval/BlackFemale2.csv')], [pd.read_csv('eval/BlackMale2.csv')], [pd.read_csv('eval/WhiteFemale2.csv')], [pd.read_csv('eval/WhiteMale2.csv')]] class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): eid = models.IntegerField() consent_choice = models.StringField( label="", choices=["Consent", "Do not consent"], widget=widgets.RadioSelect ) prolific_id = models.StringField(label="What is your Prolific ID?") # with basic info mh = models.IntegerField(min=0, max=100) sh = models.IntegerField(min=0, max=100) ch = models.IntegerField(min=0, max=100) mh2 = models.IntegerField(min=0, max=100) sh2 = models.IntegerField(min=0, max=100) ch2 = models.IntegerField(min=0, max=100) mh3 = models.IntegerField(min=0, max=100) sh3 = models.IntegerField(min=0, max=100) ch3 = models.IntegerField(min=0, max=100) mh4 = models.IntegerField(min=0, max=100) sh4 = models.IntegerField(min=0, max=100) ch4 = models.IntegerField(min=0, max=100) mh5 = models.IntegerField(min=0, max=100) sh5 = models.IntegerField(min=0, max=100) ch5 = models.IntegerField(min=0, max=100) mh6 = models.IntegerField(min=0, max=100) sh6 = models.IntegerField(min=0, max=100) ch6 = models.IntegerField(min=0, max=100) # with additional info mh7 = models.IntegerField(min=0, max=100) sh7 = models.IntegerField(min=0, max=100) ch7 = models.IntegerField(min=0, max=100) mh8 = models.IntegerField(min=0, max=100) sh8 = models.IntegerField(min=0, max=100) ch8 = models.IntegerField(min=0, max=100) mh9 = models.IntegerField(min=0, max=100) sh9 = models.IntegerField(min=0, max=100) ch9 = models.IntegerField(min=0, max=100) mh10 = models.IntegerField(min=0, max=100) sh10 = models.IntegerField(min=0, max=100) ch10 = models.IntegerField(min=0, max=100) # willingness to pay wtpM11 = models.IntegerField() wtpS11 = models.IntegerField() wtpC11 = models.IntegerField() wtpM12 = models.IntegerField() wtpS12 = models.IntegerField() wtpC12 = models.IntegerField() wtpM13 = models.IntegerField() wtpS13 = models.IntegerField() wtpC13 = models.IntegerField() wtpM14 = models.IntegerField() wtpS14 = models.IntegerField() wtpC14 = models.IntegerField() att = models.StringField() att2 = models.StringField() att3 = models.StringField() att4 = models.StringField() att5 = models.StringField() att6 = models.StringField() att7 = models.StringField() att8 = models.StringField() att9 = models.StringField() att10 = models.StringField() att11 = models.StringField() att12 = models.StringField() att13 = models.StringField() att14 = models.StringField() mathlog = models.IntegerField() soclog = models.IntegerField() comblog = models.IntegerField() compG1 = models.IntegerField() compG2 = models.IntegerField() compG3 = models.IntegerField() pay_n = models.IntegerField() pay_t = models.IntegerField() pay_t2 = models.IntegerField() pay_t3 = models.IntegerField() guessracem = models.StringField( label="", choices=["White", "Black", "Asian"], widget=widgets.RadioSelect ) guessgenderm = models.StringField( label="", choices=["Male", "Female"], widget=widgets.RadioSelect ) guessraces = models.StringField( label="", choices=["White", "Black", "Asian"], widget=widgets.RadioSelect ) guessgenders = models.StringField( label="", choices=["Male", "Female"], widget=widgets.RadioSelect ) # PAGES class Consent(Page): pass class Consent2(Page): form_model = "player" form_fields = ['consent_choice'] class EndNowC(Page): @staticmethod def is_displayed(player): return player.consent_choice == 'Do not consent' class ProlificID(Page): form_model = "player" form_fields = ["prolific_id"] class InstG(Page): form_model = 'player' form_fields = ['compG1', 'mathlog', 'soclog', 'comblog'] @staticmethod def before_next_page(player: Player, timeout_happened): player.eid = player.participant.id_in_session list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14] list2 = [1, 2, 3] random.shuffle(list1) random.shuffle(list2) player.pay_n = list1[0] player.pay_t = list2[0] # print(C.Info[0]) @staticmethod def error_message(player, values): if values['compG1'] != 2: return 'Please try again.' class InstG2(Page): form_model = 'player' form_fields = ['compG2', 'compG3'] @staticmethod def error_message(player, values): if values['compG2'] != 3: return 'Please try again: Note that the first question asks to choose "True" choice and the second question asks to choose "False" choice. Also, you should submit the answers for both questions again. Hint: You would see the explanation once you click a choice. Green-colored text explanation means a choice is True, and the red-colored choice text explanation means a choice is False.' if values['compG3'] != 2: return 'Please try again: Note that the first question asks to choose "True" choice and the second question asks to choose "False" choice. Also, you should submit the answers for both questions again. Hint: You would see the explanation once you click a choice. Green-colored text explanation means a choice is True, and the red-colored choice text explanation means a choice is False. ' class InstG3(Page): pass class PreQ(Page): form_model='player' form_fields= ['guessracem', 'guessgenderm', 'guessraces','guessgenders'] class InstB2(Page): pass class InstB3(Page): pass class Belief1(Page): form_model = 'player' form_fields = ['mh', 'sh', 'ch', 'att'] def vars_for_template(player: Player): infoCall = C.InfoAF.values infoID = C.CandiID.values infoR = C.CandiR.values k = player.eid-1 a = 1 if infoR[k][a] == 2: infoCall = C.InfoAM.values if infoR[k][a] == 3: infoCall = C.InfoBF.values if infoR[k][a] == 4: infoCall = C.InfoBM.values if infoR[k][a] == 5: infoCall = C.InfoWF.values if infoR[k][a] == 6: infoCall = C.InfoWM.values idc = infoID[k][a]-1 infoG = infoCall[idc][1] infoR = infoCall[idc][2] infoH = infoCall[idc][3] infoM = infoCall[idc][4] infoA = infoCall[idc][5] return dict( info1=infoG, info2=infoR, info3=infoH, info4=infoM, info5=infoA, ) class Belief2(Page): form_model = 'player' form_fields = ['mh2', 'sh2', 'ch2', 'att2'] def vars_for_template(player: Player): infoCall = C.InfoAF.values infoID = C.CandiID.values infoR = C.CandiR.values k = player.eid-1 a = 2 if infoR[k][a] == 2: infoCall = C.InfoAM.values if infoR[k][a] == 3: infoCall = C.InfoBF.values if infoR[k][a] == 4: infoCall = C.InfoBM.values if infoR[k][a] == 5: infoCall = C.InfoWF.values if infoR[k][a] == 6: infoCall = C.InfoWM.values idc = infoID[k][a]-1 infoG = infoCall[idc][1] infoR = infoCall[idc][2] infoH = infoCall[idc][3] infoM = infoCall[idc][4] infoA = infoCall[idc][5] return dict( info1=infoG, info2=infoR, info3=infoH, info4=infoM, info5=infoA, ) class Belief3(Page): form_model = 'player' form_fields = ['mh3', 'sh3', 'ch3', 'att3'] def vars_for_template(player: Player): infoCall = C.InfoAF.values infoID = C.CandiID.values infoR = C.CandiR.values k = player.eid-1 a = 3 if infoR[k][a] == 2: infoCall = C.InfoAM.values if infoR[k][a] == 3: infoCall = C.InfoBF.values if infoR[k][a] == 4: infoCall = C.InfoBM.values if infoR[k][a] == 5: infoCall = C.InfoWF.values if infoR[k][a] == 6: infoCall = C.InfoWM.values idc = infoID[k][a]-1 infoG = infoCall[idc][1] infoR = infoCall[idc][2] infoH = infoCall[idc][3] infoM = infoCall[idc][4] infoA = infoCall[idc][5] return dict( info1=infoG, info2=infoR, info3=infoH, info4=infoM, info5=infoA, ) class Belief4(Page): form_model = 'player' form_fields = ['mh4', 'sh4', 'ch4', 'att4'] def vars_for_template(player: Player): infoCall = C.InfoAF.values infoID = C.CandiID.values infoR = C.CandiR.values k = player.eid-1 a = 4 if infoR[k][a] == 2: infoCall = C.InfoAM.values if infoR[k][a] == 3: infoCall = C.InfoBF.values if infoR[k][a] == 4: infoCall = C.InfoBM.values if infoR[k][a] == 5: infoCall = C.InfoWF.values if infoR[k][a] == 6: infoCall = C.InfoWM.values idc = infoID[k][a]-1 infoG = infoCall[idc][1] infoR = infoCall[idc][2] infoH = infoCall[idc][3] infoM = infoCall[idc][4] infoA = infoCall[idc][5] return dict( info1=infoG, info2=infoR, info3=infoH, info4=infoM, info5=infoA, ) class Belief5(Page): form_model = 'player' form_fields = ['mh5', 'sh5', 'ch5', 'att5'] def vars_for_template(player: Player): infoCall = C.InfoAF.values infoID = C.CandiID.values infoR = C.CandiR.values k = player.eid-1 a = 5 if infoR[k][a] == 2: infoCall = C.InfoAM.values if infoR[k][a] == 3: infoCall = C.InfoBF.values if infoR[k][a] == 4: infoCall = C.InfoBM.values if infoR[k][a] == 5: infoCall = C.InfoWF.values if infoR[k][a] == 6: infoCall = C.InfoWM.values idc = infoID[k][a]-1 infoG = infoCall[idc][1] infoR = infoCall[idc][2] infoH = infoCall[idc][3] infoM = infoCall[idc][4] infoA = infoCall[idc][5] return dict( info1=infoG, info2=infoR, info3=infoH, info4=infoM, info5=infoA, ) class Belief6(Page): form_model = 'player' form_fields = ['mh6', 'sh6', 'ch6', 'att6'] def vars_for_template(player: Player): infoCall = C.InfoAF.values infoID = C.CandiID.values infoR = C.CandiR.values k = player.eid-1 a = 6 if infoR[k][a] == 2: infoCall = C.InfoAM.values if infoR[k][a] == 3: infoCall = C.InfoBF.values if infoR[k][a] == 4: infoCall = C.InfoBM.values if infoR[k][a] == 5: infoCall = C.InfoWF.values if infoR[k][a] == 6: infoCall = C.InfoWM.values idc = infoID[k][a]-1 infoG = infoCall[idc][1] infoR = infoCall[idc][2] infoH = infoCall[idc][3] infoM = infoCall[idc][4] infoA = infoCall[idc][5] return dict( info1=infoG, info2=infoR, info3=infoH, info4=infoM, info5=infoA, ) class Belief7(Page): form_model = 'player' form_fields = ['mh7', 'sh7', 'ch7', 'att7'] def vars_for_template(player: Player): infoCall = C.InfoAF.values infoID = C.CandiID.values infoR = C.CandiR.values k=player.eid-1 a=7 if infoR[k][a] == 2: infoCall = C.InfoAM.values if infoR[k][a] == 3: infoCall = C.InfoBF.values if infoR[k][a] == 4: infoCall = C.InfoBM.values if infoR[k][a] == 5: infoCall = C.InfoWF.values if infoR[k][a] == 6: infoCall = C.InfoWM.values idc = infoID[k][a]-1 infoG = infoCall[idc][1] infoR = infoCall[idc][2] infoH = infoCall[idc][3] infoM = infoCall[idc][4] infoA = infoCall[idc][5] infoAP = infoCall[idc][6] infoInv = infoCall[idc][7] return dict( info1=infoG, info2=infoR, info3=infoH, info4=infoM, info5=infoA, info6=infoAP, info7=infoInv ) class Belief8(Page): form_model = 'player' form_fields = ['mh8', 'sh8', 'ch8', 'att8'] def vars_for_template(player: Player): infoCall = C.InfoAF.values infoID = C.CandiID.values infoR = C.CandiR.values k=player.eid-1 a=8 if infoR[k][a] == 2: infoCall = C.InfoAM.values if infoR[k][a] == 3: infoCall = C.InfoBF.values if infoR[k][a] == 4: infoCall = C.InfoBM.values if infoR[k][a] == 5: infoCall = C.InfoWF.values if infoR[k][a] == 6: infoCall = C.InfoWM.values idc = infoID[k][a]-1 infoG = infoCall[idc][1] infoR = infoCall[idc][2] infoH = infoCall[idc][3] infoM = infoCall[idc][4] infoA = infoCall[idc][5] infoAP = infoCall[idc][6] infoInv = infoCall[idc][7] return dict( info1=infoG, info2=infoR, info3=infoH, info4=infoM, info5=infoA, info6=infoAP, info7=infoInv ) class Belief9(Page): form_model = 'player' form_fields = ['mh9', 'sh9', 'ch9', 'att9'] def vars_for_template(player: Player): infoCall = C.InfoAF.values infoID = C.CandiID.values infoR = C.CandiR.values k=player.eid-1 a=9 if infoR[k][a] == 2: infoCall = C.InfoAM.values if infoR[k][a] == 3: infoCall = C.InfoBF.values if infoR[k][a] == 4: infoCall = C.InfoBM.values if infoR[k][a] == 5: infoCall = C.InfoWF.values if infoR[k][a] == 6: infoCall = C.InfoWM.values idc = infoID[k][a]-1 infoG = infoCall[idc][1] infoR = infoCall[idc][2] infoH = infoCall[idc][3] infoM = infoCall[idc][4] infoA = infoCall[idc][5] infoAP = infoCall[idc][6] infoInv = infoCall[idc][7] return dict( info1=infoG, info2=infoR, info3=infoH, info4=infoM, info5=infoA, info6=infoAP, info7=infoInv ) class Belief10(Page): form_model = 'player' form_fields = ['mh10', 'sh10', 'ch10', 'att10'] def vars_for_template(player: Player): infoCall = C.InfoAF.values infoID = C.CandiID.values infoR = C.CandiR.values k=player.eid-1 a=10 if infoR[k][a] == 2: infoCall = C.InfoAM.values if infoR[k][a] == 3: infoCall = C.InfoBF.values if infoR[k][a] == 4: infoCall = C.InfoBM.values if infoR[k][a] == 5: infoCall = C.InfoWF.values if infoR[k][a] == 6: infoCall = C.InfoWM.values idc = infoID[k][a]-1 infoG = infoCall[idc][1] infoR = infoCall[idc][2] infoH = infoCall[idc][3] infoM = infoCall[idc][4] infoA = infoCall[idc][5] infoAP = infoCall[idc][6] infoInv = infoCall[idc][7] return dict( info1=infoG, info2=infoR, info3=infoH, info4=infoM, info5=infoA, info6=infoAP, info7=infoInv ) class InstW(Page): pass class WTP1(Page): form_model = 'player' form_fields = ['wtpM11', 'wtpS11', 'wtpC11', 'att11'] def vars_for_template(player: Player): infoCall = C.InfoAF.values infoID = C.CandiID.values infoR = C.CandiR.values k = player.eid - 1 a=11 if infoR[k][a] == 2: infoCall = C.InfoAM.values if infoR[k][a] == 3: infoCall = C.InfoBF.values if infoR[k][a] == 4: infoCall = C.InfoBM.values if infoR[k][a] == 5: infoCall = C.InfoWF.values if infoR[k][a] == 6: infoCall = C.InfoWM.values idc = infoID[k][a] - 1 infoG = infoCall[idc][1] infoR = infoCall[idc][2] infoH = infoCall[idc][3] infoM = infoCall[idc][4] infoA = infoCall[idc][5] infoAP = infoCall[idc][6] infoInv = infoCall[idc][7] return dict( info1=infoG, info2=infoR, info3=infoH, info4=infoM, info5=infoA, info6=infoAP, info7=infoInv ) class WTP2(Page): form_model = 'player' form_fields = ['wtpM12', 'wtpS12', 'wtpC12', 'att12'] def vars_for_template(player: Player): infoCall = C.InfoAF.values infoID = C.CandiID.values infoR = C.CandiR.values k = player.eid - 1 a=12 if infoR[k][a] == 2: infoCall = C.InfoAM.values if infoR[k][a] == 3: infoCall = C.InfoBF.values if infoR[k][a] == 4: infoCall = C.InfoBM.values if infoR[k][a] == 5: infoCall = C.InfoWF.values if infoR[k][a] == 6: infoCall = C.InfoWM.values idc = infoID[k][a] - 1 infoG = infoCall[idc][1] infoR = infoCall[idc][2] infoH = infoCall[idc][3] infoM = infoCall[idc][4] infoA = infoCall[idc][5] infoAP = infoCall[idc][6] infoInv = infoCall[idc][7] return dict( info1=infoG, info2=infoR, info3=infoH, info4=infoM, info5=infoA, info6=infoAP, info7=infoInv ) class WTP3(Page): form_model = 'player' form_fields = ['wtpM13', 'wtpS13', 'wtpC13', 'att13'] def vars_for_template(player: Player): infoCall = C.InfoAF.values infoID = C.CandiID.values infoR = C.CandiR.values k = player.eid - 1 a=13 if infoR[k][a] == 2: infoCall = C.InfoAM.values if infoR[k][a] == 3: infoCall = C.InfoBF.values if infoR[k][a] == 4: infoCall = C.InfoBM.values if infoR[k][a] == 5: infoCall = C.InfoWF.values if infoR[k][a] == 6: infoCall = C.InfoWM.values idc = infoID[k][a] - 1 infoG = infoCall[idc][1] infoR = infoCall[idc][2] infoH = infoCall[idc][3] infoM = infoCall[idc][4] infoA = infoCall[idc][5] infoAP = infoCall[idc][6] infoInv = infoCall[idc][7] return dict( info1=infoG, info2=infoR, info3=infoH, info4=infoM, info5=infoA, info6=infoAP, info7=infoInv ) class WTP4(Page): form_model = 'player' form_fields = ['wtpM14', 'wtpS14', 'wtpC14', 'att14'] def vars_for_template(player: Player): infoCall = C.InfoAF.values infoID = C.CandiID.values infoR = C.CandiR.values k = player.eid - 1 a=14 if infoR[k][a] == 2: infoCall = C.InfoAM.values if infoR[k][a] == 3: infoCall = C.InfoBF.values if infoR[k][a] == 4: infoCall = C.InfoBM.values if infoR[k][a] == 5: infoCall = C.InfoWF.values if infoR[k][a] == 6: infoCall = C.InfoWM.values idc = infoID[k][a] - 1 infoG = infoCall[idc][1] infoR = infoCall[idc][2] infoH = infoCall[idc][3] infoM = infoCall[idc][4] infoA = infoCall[idc][5] infoAP = infoCall[idc][6] infoInv = infoCall[idc][7] return dict( info1=infoG, info2=infoR, info3=infoH, info4=infoM, info5=infoA, info6=infoAP, info7=infoInv ) class Results(Page): form_model = 'player' def before_next_page(player: Player, timeout_happened): infoID = C.CandiID.values infoR = C.CandiR.values k = player.eid - 1 if infoR[k][player.pay_n] == 1: infoCall = C.InfoAF.values if infoR[k][player.pay_n] == 2: infoCall = C.InfoAM.values if infoR[k][player.pay_n] == 3: infoCall = C.InfoBF.values if infoR[k][player.pay_n] == 4: infoCall = C.InfoBM.values if infoR[k][player.pay_n] == 5: infoCall = C.InfoWF.values if infoR[k][player.pay_n] == 6: infoCall = C.InfoWM.values idc = infoID[k][player.pay_n] - 1 numbers = [20, 0] mhprob = [0.01*player.mh, 0.01*player.mh2, 0.01*player.mh3, 0.01*player.mh4, 0.01*player.mh5, 0.01*player.mh6, 0.01*player.mh7, 0.01*player.mh8, 0.01*player.mh9, 0.01*player.mh10] shprob = [0.01 * player.sh, 0.01 * player.sh2, 0.01 * player.sh3, 0.01 * player.sh4, 0.01 * player.sh5, 0.01 * player.sh6, 0.01 * player.sh7, 0.01 * player.sh8, 0.01 * player.sh9, 0.01 * player.sh10] chprob = [0.01 * player.ch, 0.01 * player.ch2, 0.01 * player.ch3, 0.01 * player.ch4, 0.01 * player.ch5, 0.01 * player.ch6, 0.01 * player.ch7, 0.01 * player.ch8, 0.01 * player.ch9, 0.01 * player.ch10] if player.pay_n < 11: player.pay_t2 = -1 if player.pay_t == 1: player.pay_t3 = infoCall[idc][8] x = mhprob[player.pay_n-1] if infoCall[idc][8] == 1: dist = [1 - (1 - x)**2, (1 - x)**2] y = random.choices(numbers, dist, k=1) player.payoff = y[0] if infoCall[idc][8] == 0: dist = [1 - x**2, x**2] y = random.choices(numbers, dist, k=1) player.payoff = y[0] if player.pay_t == 2: player.pay_t3 = infoCall[idc][9] x = shprob[player.pay_n-1] if infoCall[idc][9] == 1: dist = [1 - (1 - x)**2, (1 - x)**2] y = random.choices(numbers, dist, k=1) player.payoff = y[0] if infoCall[idc][9] == 0: dist = [1 - x**2, x**2] y = random.choices(numbers, dist, k=1) player.payoff = y[0] if player.pay_t == 3: player.pay_t3 = infoCall[idc][10] x = chprob[player.pay_n-1] if infoCall[idc][10] == 1: dist = [1 - (1 - x)**2, (1 - x)**2] y = random.choices(numbers, dist, k=1) player.payoff = y[0] if infoCall[idc][10] == 0: dist = [1 - x**2, x**2] y = random.choices(numbers, dist, k=1) player.payoff = y[0] if player.pay_n > 10: list0 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20] random.shuffle(list0) player.pay_t2 = list0[0] wage = player.pay_t2 Mwtp = [player.wtpM11, player.wtpM12, player.wtpM13, player.wtpM14] Swtp = [player.wtpS11, player.wtpS12, player.wtpS13, player.wtpS14] Cwtp = [player.wtpC11, player.wtpC12, player.wtpC13, player.wtpC14] if player.pay_t==1: player.pay_t3 = infoCall[idc][8] if wage > Mwtp[player.pay_n-11]: player.payoff = 0 if wage < Mwtp[player.pay_n-11]: if infoCall[idc][8] == 0: player.payoff = 10-wage elif infoCall[idc][8] == 1: player.payoff = 20-wage if wage == Mwtp[player.pay_n-11]: if infoCall[idc][8] == 0: player.payoff = 10-wage elif infoCall[idc][8] == 1: player.payoff = 20-wage if player.pay_t==2: player.pay_t3 = infoCall[idc][9] if wage > Swtp[player.pay_n-11]: player.payoff = 0 if wage < Swtp[player.pay_n-11]: if infoCall[idc][9] == 0: player.payoff = 10-wage elif infoCall[idc][9] == 1: player.payoff = 20-wage if wage == Swtp[player.pay_n-11]: if infoCall[idc][9] == 0: player.payoff = 10-wage elif infoCall[idc][9] == 1: player.payoff = 20-wage if player.pay_t==3: player.pay_t3 = infoCall[idc][10] if wage > Cwtp[player.pay_n-11]: player.payoff = 0 if wage < Cwtp[player.pay_n-11]: if infoCall[idc][10] == 0: player.payoff = 10-wage elif infoCall[idc][10] == 1: player.payoff = 20-wage if wage == Cwtp[player.pay_n-11]: if infoCall[idc][10] == 0: player.payoff = 10-wage elif infoCall[idc][10] == 1: player.payoff = 20-wage class Results2(Page): def vars_for_template(player: Player): n1=player.pay_n n2=player.pay_t n3=player.pay_t2 n4=player.pay_t3 if n4 == 1: n4 = 'High' elif n4 == 0: n4 = 'Low' if n2 == 1: n2 = 'Math' elif n2 == 2: n2 = 'Social' elif n2 == 3: n2 = 'Combined' return dict( n1=n1, n2=n2, n3=n3, n4=n4 ) class Belief1_example(Page): form_model = 'player' form_fields = ['mh', 'sh', 'ch', 'att'] def vars_for_template(player: Player): infoG='Male' infoR='White' infoH='Littleton' infoM='Proficient' infoA='Novice' return dict( info1=infoG, info2=infoR, info3=infoH, info4=infoM, info5=infoA, ) page_sequence = [InstG, Belief1,Belief7, WTP1, Results] # page_sequence = [InstG, InstG2, InstB2, Belief1, Belief2, Belief3, Belief4, # Belief5, Belief6, InstB3, Belief7, Belief8, Belief9, Belief10, # InstW, WTP1, WTP2, WTP3, WTP4, Results, Results2] # page_sequence = [Consent, Consent2, EndNowC, ProlificID, InstG, InstG2, InstB2, Belief1, Belief2, Belief3, Belief4, # Belief5, Belief6, InstB3, Belief7, Belief8, Belief9, Belief10, # InstW, WTP1, WTP2, WTP3, WTP4, Results, Results2]