from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range, ) import random import string doc = """ これは3人グループで行われるゲームです。 """ class Constants(BaseConstants): name_in_url = 'public_goods_resettlement1213' players_per_group = 3 num_rounds = 4 instructions_template = 'public_goods_resettlement_1213/instructions.html' # """Amount allocated to each player""" multiplier = 1 endowment = 0 class Subsession(BaseSubsession): def group_by_arrival_time_method(self, waiting_players): print('in group_by_arrival_time_method') for p in self.get_players(): p.roleID = p.in_round(1).id_in_group % 3 id1 = [p for p in waiting_players if p.roleID == 1] id2 = [p for p in waiting_players if p.roleID == 2] id3 = [p for p in waiting_players if p.roleID == 0] if len(id1) >=1 and len(id2) >=1 and len(id3) >=1: print('about to create a group') return [id1[0], id2[0], id3[0]] print('not enough players yet to create a group') class Group(BaseGroup): victim = models.IntegerField() divisionR = models.IntegerField() border = models.IntegerField() compensationR = models.IntegerField() compensationRv = models.IntegerField() def set_victim(self): if self.round_number == 1: self.victim = 1 if self.round_number == 2: self.victim = 2 if self.round_number == 3: self.victim = 1 if self.round_number == 4: self.victim = 3 def set_division(self): if self.round_number == 3: if sum([p.compensationP2 for p in self.get_players()])+ sum([p.compensationP2victim for p in self.get_players()]) < 0: self. divisionR = 0 else : players = self.get_players() self.divisionR = min([p.divisionP2 for p in players]) if self.round_number == 4: if sum([p.compensationP2 for p in self.get_players()])+ sum([p.compensationP2victim for p in self.get_players()]) < 0: self. divisionR = 0 else: players = self.get_players() self.divisionR = min([p.divisionP2 for p in players]) if self.round_number == 1: #まだどの選択肢にするか決まってない l = [2,4] self.divisionR = random.choice(l) if self.round_number == 2: #ここも後で直す l = [2,4] self.divisionR = random.choice(l) def set_failure(self): if self.round_number == 3: if self.divisionR == 0: self.border = -125 else: players = self.get_players() self.border = sum([p.compensationP2 for p in players])+ sum([p.compensationP2victim for p in players]) elif self.round_number == 4: if self.divisionR == 0: self.border = -125 else: players = self.get_players() self.border = sum([p.compensationP2 for p in players])+ sum([p.compensationP2victim for p in players]) else: self.border = 1999 def set_compensation(self): if self.round_number == 3: players = self.get_players() if self.border < 0: for p in self.get_players(): p.payingcompensationR = 0 p.receivingcompensationR = 0 else: for p in self.get_players(): if p.id_in_group == self.victim: p.payingcompensationR = 0 p.receivingcompensationR = -p.compensationP2victim * self.divisionR + round((self.border * self.divisionR)/3) else: p.payingcompensationR = p.compensationP2 * self.divisionR - round((self.border * self.divisionR/3)) p.receivingcompensationR = 0 if self.round_number == 4: players = self.get_players() if self.border < 0: for p in self.get_players(): p.payingcompensationR = 0 p.receivingcompensationR = 0 else: for p in self.get_players(): if p.id_in_group == self.victim: p.payingcompensationR = 0 p.receivingcompensationR = -p.compensationP2victim * self.divisionR + round((self.border * self.divisionR)/3) else: p.payingcompensationR = p.compensationP2 * self.divisionR - round((self.border * self.divisionR/3)) p.receivingcompensationR = 0 if self.round_number == 1: for p in self.get_players(): if p.id_in_group == self.victim: p.payingcompensationR = 0 if self.id_in_subsession % 2 == 1: self.compensationR = 1 self.compensationRv = self.compensationR * 2 p.receivingcompensationR = 2 * 1 * self.divisionR else: self.compensationR = 4 self.compensationRv = self.compensationR * 2 p.receivingcompensationR = 2 * 4 * self.divisionR else: if self.id_in_subsession % 2 == 1: self.compensationR = 1 self.compensationRv = self.compensationR * 2 p.payingcompensationR = 1 * self.divisionR else: self.compensationR = 4 self.compensationRv = self.compensationR * 2 p.payingcompensationR = 4 * self.divisionR p.receivingcompensationR = 0 if self.round_number == 2: for p in self.get_players(): if p.id_in_group == self.victim: p.payingcompensationR = 0 if self.id_in_subsession % 2 == 1: self.compensationR = 4 self.compensationRv = self.compensationR * 2 p.receivingcompensationR = 2 * 4 * self.divisionR else: self.compensationR = 1 self.compensationRv = self.compensationR * 2 p.receivingcompensationR = 2 * 1 * self.divisionR else: if self.id_in_subsession % 2 == 1: self.compensationR = 4 self.compensationRv = self.compensationR * 2 p.payingcompensationR = 4 * self.divisionR else: self.compensationR = 1 self.compensationRv = self.compensationR * 2 p.payingcompensationR = 1 * self.divisionR p.receivingcompensationR = 0 #Questions and Answers 1A to 1Z def set_que1(self): for p in self.get_players(): p.que1A1 = random.randint(10,99) p.que1B1 = random.randint(10,99) p.que1C1 = random.randint(10,99) p.que1D1 = random.randint(10,99) p.que1E1 = random.randint(10,99) p.que1F1 = random.randint(10,99) p.que1G1 = random.randint(10,99) p.que1H1 = random.randint(10,99) p.que1I1 = random.randint(10,99) p.que1J1 = random.randint(10,99) p.que1K1 = random.randint(10,99) p.que1L1 = random.randint(10,99) p.que1M1 = random.randint(10,99) p.que1N1 = random.randint(10,99) p.que1O1 = random.randint(10,99) p.que1P1 = random.randint(10,99) p.que1Q1 = random.randint(10,99) p.que1R1 = random.randint(10,99) p.que1S1 = random.randint(10,99) p.que1T1 = random.randint(10,99) p.que1A2 = random.randint(0,9) p.que1B2 = random.randint(0,9) p.que1C2 = random.randint(0,9) p.que1D2 = random.randint(0,9) p.que1E2 = random.randint(0,9) p.que1F2 = random.randint(0,9) p.que1G2 = random.randint(0,9) p.que1H2 = random.randint(0,9) p.que1I2 = random.randint(0,9) p.que1J2 = random.randint(0,9) p.que1K2 = random.randint(0,9) p.que1L2 = random.randint(0,9) p.que1M2 = random.randint(0,9) p.que1N2 = random.randint(0,9) p.que1O2 = random.randint(0,9) p.que1P2 = random.randint(0,9) p.que1Q2 = random.randint(0,9) p.que1R2 = random.randint(0,9) p.que1S2 = random.randint(0,9) p.que1T2 = random.randint(0,9) p.que1A = p.que1A1 + p.que1A2 p.que1B = p.que1B1 + p.que1B2 p.que1C = p.que1C1 + p.que1C2 p.que1D = p.que1D1 + p.que1D2 p.que1E = p.que1E1 + p.que1E2 p.que1F = p.que1F1 + p.que1F2 p.que1G = p.que1G1 + p.que1G2 p.que1H = p.que1H1 + p.que1H2 p.que1I = p.que1I1 + p.que1I2 p.que1J = p.que1J1 + p.que1J2 p.que1K = p.que1K1 + p.que1K2 p.que1L = p.que1L1 + p.que1L2 p.que1M = p.que1M1 + p.que1M2 p.que1N = p.que1N1 + p.que1N2 p.que1O = p.que1O1 + p.que1O2 p.que1P = p.que1P1 + p.que1P2 p.que1Q = p.que1Q1 + p.que1Q2 p.que1R = p.que1R1 + p.que1R2 p.que1S = p.que1S1 + p.que1S2 p.que1T = p.que1T1 + p.que1T2 #Questions and Answers 2A to 2Z def set_que2(self): for p in self.get_players(): p.que2A1 = random.randint(10,99) p.que2B1 = random.randint(10,99) p.que2C1 = random.randint(10,99) p.que2D1 = random.randint(10,99) p.que2E1 = random.randint(10,99) p.que2F1 = random.randint(10,99) p.que2G1 = random.randint(10,99) p.que2H1 = random.randint(10,99) p.que2I1 = random.randint(10,99) p.que2J1 = random.randint(10,99) p.que2K1 = random.randint(10,99) p.que2L1 = random.randint(10,99) p.que2M1 = random.randint(10,99) p.que2N1 = random.randint(10,99) p.que2O1 = random.randint(10,99) p.que2P1 = random.randint(10,99) p.que2Q1 = random.randint(10,99) p.que2R1 = random.randint(10,99) p.que2S1 = random.randint(10,99) p.que2T1 = random.randint(10,99) p.que2A2 = random.randint(0,9) p.que2B2 = random.randint(0,9) p.que2C2 = random.randint(0,9) p.que2D2 = random.randint(0,9) p.que2E2 = random.randint(0,9) p.que2F2 = random.randint(0,9) p.que2G2 = random.randint(0,9) p.que2H2 = random.randint(0,9) p.que2I2 = random.randint(0,9) p.que2J2 = random.randint(0,9) p.que2K2 = random.randint(0,9) p.que2L2 = random.randint(0,9) p.que2M2 = random.randint(0,9) p.que2N2 = random.randint(0,9) p.que2O2 = random.randint(0,9) p.que2P2 = random.randint(0,9) p.que2Q2 = random.randint(0,9) p.que2R2 = random.randint(0,9) p.que2S2 = random.randint(0,9) p.que2T2 = random.randint(0,9) p.que2A = p.que2A1 + p.que2A2 p.que2B = p.que2B1 + p.que2B2 p.que2C = p.que2C1 + p.que2C2 p.que2D = p.que2D1 + p.que2D2 p.que2E = p.que2E1 + p.que2E2 p.que2F = p.que2F1 + p.que2F2 p.que2G = p.que2G1 + p.que2G2 p.que2H = p.que2H1 + p.que2H2 p.que2I = p.que2I1 + p.que2I2 p.que2J = p.que2J1 + p.que2J2 p.que2K = p.que2K1 + p.que2K2 p.que2L = p.que2L1 + p.que2L2 p.que2M = p.que2M1 + p.que2M2 p.que2N = p.que2N1 + p.que2N2 p.que2O = p.que2O1 + p.que2O2 p.que2P = p.que2P1 + p.que2P2 p.que2Q = p.que2Q1 + p.que2Q2 p.que2R = p.que2R1 + p.que2R2 p.que2S = p.que2S1 + p.que2S2 p.que2T = p.que2T1 + p.que2T2 def set_earning1(self): for p in self.get_players(): p.earning1 = 0 if p.que1A == p.ans1A: p.earning1 += 5 if p.que1B == p.ans1B: p.earning1 += 5 if p.que1C == p.ans1C: p.earning1 += 5 if p.que1D == p.ans1D: p.earning1 += 5 if p.que1E == p.ans1E: p.earning1 += 5 if p.que1F == p.ans1F: p.earning1 += 5 if p.que1G == p.ans1G: p.earning1 += 5 if p.que1H == p.ans1H: p.earning1 += 5 if p.que1I == p.ans1I: p.earning1 += 5 if p.que1J == p.ans1J: p.earning1 += 5 if p.que1K == p.ans1K: p.earning1 += 5 if p.que1L == p.ans1L: p.earning1 += 5 if p.que1M == p.ans1M: p.earning1 += 5 if p.que1N == p.ans1N: p.earning1 += 5 if p.que1O == p.ans1O: p.earning1 += 5 if p.que1P == p.ans1P: p.earning1 += 5 if p.que1Q == p.ans1Q: p.earning1 += 5 if p.que1R == p.ans1R: p.earning1 += 5 if p.que1S == p.ans1S: p.earning1 += 5 if p.que1T == p.ans1T: p.earning1 += 5 def set_earning2(self): for p in self.get_players(): p.earning2 = 0 if p.que2A == p.ans2A: p.earning2 += 5 if p.que2B == p.ans2B: p.earning2 += 5 if p.que2C == p.ans2C: p.earning2 += 5 if p.que2D == p.ans2D: p.earning2 += 5 if p.que2E == p.ans2E: p.earning2 += 5 if p.que2F == p.ans2F: p.earning2 += 5 if p.que2G == p.ans2G: p.earning2 += 5 if p.que2H == p.ans2H: p.earning2 += 5 if p.que2I == p.ans2I: p.earning2 += 5 if p.que2J == p.ans2J: p.earning2 += 5 if p.que2K == p.ans2K: p.earning2 += 5 if p.que2L == p.ans2L: p.earning2 += 5 if p.que2M == p.ans2M: p.earning2 += 5 if p.que2N == p.ans2N: p.earning2 += 5 if p.que2O == p.ans2O: p.earning2 += 5 if p.que2P == p.ans2P: p.earning2 += 5 if p.que2Q == p.ans2Q: p.earning2 += 5 if p.que2R == p.ans2R: p.earning2 += 5 if p.que2S == p.ans2S: p.earning2 += 5 if p.que2T == p.ans2T: p.earning2 += 5 def set_payoffs(self): for p in self.get_players(): if self.divisionR == 0: if p.id_in_group == self.victim: p.payoff = round((100 * p.earning1 * 0.01) +(100 * p.earning2 * 0.01) + p.receivingcompensationR) else: p.payoff = round((100 * p.earning1 * 0.01) + (100 * p.earning2 * 0.01) - p.payingcompensationR) if self.divisionR == 1: if p.id_in_group == self.victim: p.payoff = round((88 * p.earning1 * 0.01) + (111 * p.earning2 * 0.01) + p.receivingcompensationR) else: p.payoff = round((100 * p.earning1 * 0.01) + (111 * p.earning2 * 0.01) - p.payingcompensationR) if self.divisionR == 2: if p.id_in_group == self.victim: p.payoff = round((76 * p.earning1 * 0.01) + (120 * p.earning2 * 0.01) + p.receivingcompensationR) else: p.payoff = round((100 * p.earning1 * 0.01) + (120 * p.earning2 * 0.01) - p.payingcompensationR) if self.divisionR == 3: if p.id_in_group == self.victim: p.payoff = round((64 * p.earning1 * 0.01) + (127 * p.earning2 * 0.01) + p.receivingcompensationR) else: p.payoff = round((100 * p.earning1 * 0.01) + (127 * p.earning2 * 0.01) - p.payingcompensationR) if self.divisionR == 4: if p.id_in_group == self.victim: p.payoff = round((52 * p.earning1 * 0.01) + (132 * p.earning2 * 0.01) + p.receivingcompensationR) else: p.payoff = round((100 * p.earning1 * 0.01) + (132 * p.earning2 * 0.01) - p.payingcompensationR) if self.divisionR == 5: if p.id_in_group == self.victim: p.payoff = round((40 * p.earning1 * 0.01) + (135 * p.earning2 * 0.01) + p.receivingcompensationR) else: p.payoff = round((100 * p.earning1 * 0.01) + (135 * p.earning2 * 0.01) - p.payingcompensationR) if self.divisionR == 6: if p.id_in_group == self.victim: p.payoff = round((28 * p.earning1 * 0.01) + (136 * p.earning2 * 0.01) + p.receivingcompensationR) else: p.payoff = round((100 * p.earning1 * 0.01) + (136 * p.earning2 * 0.01) - p.payingcompensationR) if self.divisionR == 7: if p.id_in_group == self.victim: p.payoff = round((16 * p.earning1 * 0.01) + (135 * p.earning2 * 0.01) + p.receivingcompensationR) else: p.payoff = round((100 * p.earning1 * 0.01) + (135 * p.earning2 * 0.01) - p.payingcompensationR) class Player(BasePlayer): roleID = models.IntegerField() feelings1_1 = models.IntegerField( choices=[ [1, 'とても不満足'], [2, '不満足'], [3, '普通'], [4, '満足'], [5, 'とても満足'], ], label='''この役割に決まったことについてどう思いますか?''' ) feelings2_1 = models.IntegerField( choices=[ [1, 'とても不満足'], [2, '不満足'], [3, '普通'], [4, '満足'], [5, 'とても満足'], ], label='''事業規模(q)の決め方についてどう思いますか?''' ) feelings2_2 = models.IntegerField( choices=[ [1, 'とても不満足'], [2, '不満足'], [3, '普通'], [4, '満足'], [5, 'とても満足'], ], label='''事業規模(q)の結果についてどう思いますか?''' ) discussion = models.IntegerField( choices=[ [1, 'はい'], [0, 'いいえ'], ], label='''話し合いはまとまりましたか?''' ) checking = models.IntegerField( choices=[ [1, 'はい'], [0, 'いいえ'], ], label='''話し合いの結果が反映されていますか?''' ) concession1 = models.IntegerField( choices=[ [1, '積極的に譲歩した'], [2, '渋々譲歩した'], [3, '譲歩しなかった'], ], label='''あなたは反対の役割の人の利益を考えて進んで譲歩しましたか?''' ) concession2 = models.IntegerField( choices=[ [1, '積極的に譲歩した'], [2, '渋々譲歩した'], [3, '譲歩しなかった'], ], label='''あなたはチーム全体の利益を考えて進んで譲歩しましたか?''' ) feelings3_1 = models.IntegerField( choices=[ [1, 'とても不満足'], [2, '不満足'], [3, '普通'], [4, '満足'], [5, 'とても満足'], ], label='''単位補償金額(c)の決め方についてどう思いますか?''' ) feelings3_2 = models.IntegerField( choices=[ [1, 'とても不満足'], [2, '不満足'], [3, '普通'], [4, '満足'], [5, 'とても満足'], ], label='''単位補償金額(c)の結果についてどう思いますか?''' ) feelings4_1 = models.IntegerField( choices=[ [1, 'とても不満足'], [2, '不満足'], [3, '普通'], [4, '満足'], [5, 'とても満足'], ], label='''このラウンドの決め方についてどう思いますか?''' ) feelings4_2 = models.IntegerField( choices=[ [1, 'とても不満足'], [2, '不満足'], [3, '普通'], [4, '満足'], [5, 'とても満足'], ], label='''このラウンドの収入結果についてどう思いますか?''' ) earning1 = models.IntegerField() earning2 = models.IntegerField() payingcompensationR = models.IntegerField() receivingcompensationR = models.IntegerField() divisionP1 = models.IntegerField( choices=[ [0, '0'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], ], initial = 0, label = '''話し合い前、現時点で希望する事業規模を申告してください。''') compensationP1 = models.IntegerField( choices=[ [0, '0'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], ], initial = 0, label = '''話し合い前、現時点で希望する単位補償金額を申告してください。''') compensationP1victim = models.IntegerField( choices=[ [0, '0 (平均0ずつ貰う)'], [-1, '1 (平均0.5ずつ貰う)'], [-2, '2 (平均1ずつ貰う)'], [-3, '3 (平均1.5ずつ貰う)'], [-4, '4 (平均2ずつ貰う)'], [-5, '5 (平均2.5ずつ貰う)'], [-6, '6 (平均3ずつ貰う)'], [-7, '7 (平均3.5ずつ貰う)'], [-8, '8 (平均4ずつ貰う)'], [-9, '9 (平均4.5ずつ貰う)'], [-10, '10 (平均5ずつ貰う)'], ], initial = 0, label = '''話し合い前、現時点で希望する単位補償金額を申告してください。''') divisionP2 = models.IntegerField( choices=[ [0, '0'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], [6, '6'], [7, '7'], ], initial = 0, label = '''話し合い後、最終的に希望する事業規模を申告してください。''') compensationP2 = models.IntegerField( choices=[ [0, '0'], [1, '1'], [2, '2'], [3, '3'], [4, '4'], [5, '5'], ], initial = 0, label = '''話し合い後、最終的に希望する単位補償金額を申告してください。''') compensationP2victim = models.IntegerField( choices=[ [0, '0 (平均0ずつ貰う)'], [-1, '1 (平均0.5ずつ貰う)'], [-2, '2 (平均1ずつ貰う)'], [-3, '3 (平均1.5ずつ貰う)'], [-4, '4 (平均2ずつ貰う)'], [-5, '5 (平均2.5ずつ貰う)'], [-6, '6 (平均3ずつ貰う)'], [-7, '7 (平均3.5ずつ貰う)'], [-8, '8 (平均4ずつ貰う)'], [-9, '9 (平均4.5ずつ貰う)'], [-10, '10 (平均5ずつ貰う)'], ], initial = 0, label = '''話し合い後、最終的に希望する単位補償金額を申告してください。''') max1 = models.IntegerField( choices=[ [0, '100'], [1, '88'], [2, '76'], [3, '64'], [4, '52'], [5, '40'], [6, '28'], [7, '16'], [8, '未発表'], ], initial = None, label = '''あなたの今回の収入上限を上の利得表を確認して答えてください。''') max2 = models.IntegerField( choices=[ [0, 'q=0のため100'], [1, 'q=1のため111'], [2, 'q=2のため120'], [3, 'q=3のため127'], [4, 'q=4のため132'], [5, 'q=5のため135'], [6, 'q=6のため136'], [7, 'q=7のため135'], ], initial = None, label = '''あなたの今回の収入上限を上の利得表を確認して答えてください。''') #Question fields que1A1 = models.IntegerField() que1B1 = models.IntegerField() que1C1 = models.IntegerField() que1D1 = models.IntegerField() que1E1 = models.IntegerField() que1F1 = models.IntegerField() que1G1 = models.IntegerField() que1H1 = models.IntegerField() que1I1 = models.IntegerField() que1J1 = models.IntegerField() que1K1 = models.IntegerField() que1L1 = models.IntegerField() que1M1 = models.IntegerField() que1N1 = models.IntegerField() que1O1 = models.IntegerField() que1P1 = models.IntegerField() que1Q1 = models.IntegerField() que1R1 = models.IntegerField() que1S1 = models.IntegerField() que1T1 = models.IntegerField() que1A2 = models.IntegerField() que1B2 = models.IntegerField() que1C2 = models.IntegerField() que1D2 = models.IntegerField() que1E2 = models.IntegerField() que1F2 = models.IntegerField() que1G2 = models.IntegerField() que1H2 = models.IntegerField() que1I2 = models.IntegerField() que1J2 = models.IntegerField() que1K2 = models.IntegerField() que1L2 = models.IntegerField() que1M2 = models.IntegerField() que1N2 = models.IntegerField() que1O2 = models.IntegerField() que1P2 = models.IntegerField() que1Q2 = models.IntegerField() que1R2 = models.IntegerField() que1S2 = models.IntegerField() que1T2 = models.IntegerField() que1A = models.IntegerField() que1B = models.IntegerField() que1C = models.IntegerField() que1D = models.IntegerField() que1E = models.IntegerField() que1F = models.IntegerField() que1G = models.IntegerField() que1H = models.IntegerField() que1I = models.IntegerField() que1J = models.IntegerField() que1K = models.IntegerField() que1L = models.IntegerField() que1M = models.IntegerField() que1N = models.IntegerField() que1O = models.IntegerField() que1P = models.IntegerField() que1Q = models.IntegerField() que1R = models.IntegerField() que1S = models.IntegerField() que1T = models.IntegerField() que2A1 = models.IntegerField() que2B1 = models.IntegerField() que2C1 = models.IntegerField() que2D1 = models.IntegerField() que2E1 = models.IntegerField() que2F1 = models.IntegerField() que2G1 = models.IntegerField() que2H1 = models.IntegerField() que2I1 = models.IntegerField() que2J1 = models.IntegerField() que2K1 = models.IntegerField() que2L1 = models.IntegerField() que2M1 = models.IntegerField() que2N1 = models.IntegerField() que2O1 = models.IntegerField() que2P1 = models.IntegerField() que2Q1 = models.IntegerField() que2R1 = models.IntegerField() que2S1 = models.IntegerField() que2T1 = models.IntegerField() que2A2 = models.IntegerField() que2B2 = models.IntegerField() que2C2 = models.IntegerField() que2D2 = models.IntegerField() que2E2 = models.IntegerField() que2F2 = models.IntegerField() que2G2 = models.IntegerField() que2H2 = models.IntegerField() que2I2 = models.IntegerField() que2J2 = models.IntegerField() que2K2 = models.IntegerField() que2L2 = models.IntegerField() que2M2 = models.IntegerField() que2N2 = models.IntegerField() que2O2 = models.IntegerField() que2P2 = models.IntegerField() que2Q2 = models.IntegerField() que2R2 = models.IntegerField() que2S2 = models.IntegerField() que2T2 = models.IntegerField() que2A = models.IntegerField() que2B = models.IntegerField() que2C = models.IntegerField() que2D = models.IntegerField() que2E = models.IntegerField() que2F = models.IntegerField() que2G = models.IntegerField() que2H = models.IntegerField() que2I = models.IntegerField() que2J = models.IntegerField() que2K = models.IntegerField() que2L = models.IntegerField() que2M = models.IntegerField() que2N = models.IntegerField() que2O = models.IntegerField() que2P = models.IntegerField() que2Q = models.IntegerField() que2R = models.IntegerField() que2S = models.IntegerField() que2T = models.IntegerField() #Answer forms ans1A = models.IntegerField(blank=True, null=True, label='''答え''') ans1B = models.IntegerField(blank=True, null=True, label='''答え''') ans1C = models.IntegerField(blank=True, null=True, label='''答え''') ans1D = models.IntegerField(blank=True, null=True, label='''答え''') ans1E = models.IntegerField(blank=True, null=True, label='''答え''') ans1F = models.IntegerField(blank=True, null=True, label='''答え''') ans1G = models.IntegerField(blank=True, null=True, label='''答え''') ans1H = models.IntegerField(blank=True, null=True, label='''答え''') ans1I = models.IntegerField(blank=True, null=True, label='''答え''') ans1J = models.IntegerField(blank=True, null=True, label='''答え''') ans1K = models.IntegerField(blank=True, null=True, label='''答え''') ans1L = models.IntegerField(blank=True, null=True, label='''答え''') ans1M = models.IntegerField(blank=True, null=True, label='''答え''') ans1N = models.IntegerField(blank=True, null=True, label='''答え''') ans1O = models.IntegerField(blank=True, null=True, label='''答え''') ans1P = models.IntegerField(blank=True, null=True, label='''答え''') ans1Q = models.IntegerField(blank=True, null=True, label='''答え''') ans1R = models.IntegerField(blank=True, null=True, label='''答え''') ans1S = models.IntegerField(blank=True, null=True, label='''答え''') ans1T = models.IntegerField(blank=True, null=True, label='''答え''') def vars_for_admin_report(): ans1A = [ p.ans1A for p in self.get_players() ] ans1B = [ p.ans1B for p in self.get_players() ] ans1C = [ p.ans1C for p in self.get_players() ] ans1D = [ p.ans1D for p in self.get_players() ] ans1E = [ p.ans1E for p in self.get_players() ] ans1F = [ p.ans1F for p in self.get_players() ] ans1G = [ p.ans1G for p in self.get_players() ] ans1H = [ p.ans1H for p in self.get_players() ] ans1I = [ p.ans1I for p in self.get_players() ] ans1J = [ p.ans1J for p in self.get_players() ] ans1K = [ p.ans1K for p in self.get_players() ] ans1L = [ p.ans1L for l in self.get_players() ] ans1M = [ p.ans1M for p in self.get_players() ] ans1N = [ p.ans1N for p in self.get_players() ] ans1O = [ p.ans1O for p in self.get_players() ] ans1P = [ p.ans1P for p in self.get_players() ] ans1Q = [ p.ans1Q for p in self.get_players() ] ans1R = [ p.ans1R for p in self.get_players() ] ans1S = [ p.ans1S for p in self.get_players() ] ans1T = [ p.ans1T for p in self.get_players() ] #Answer forms ans2A = models.IntegerField(blank=True, null=True, label='''答え''') ans2B = models.IntegerField(blank=True, null=True, label='''答え''') ans2C = models.IntegerField(blank=True, null=True, label='''答え''') ans2D = models.IntegerField(blank=True, null=True, label='''答え''') ans2E = models.IntegerField(blank=True, null=True, label='''答え''') ans2F = models.IntegerField(blank=True, null=True, label='''答え''') ans2G = models.IntegerField(blank=True, null=True, label='''答え''') ans2H = models.IntegerField(blank=True, null=True, label='''答え''') ans2I = models.IntegerField(blank=True, null=True, label='''答え''') ans2J = models.IntegerField(blank=True, null=True, label='''答え''') ans2K = models.IntegerField(blank=True, null=True, label='''答え''') ans2L = models.IntegerField(blank=True, null=True, label='''答え''') ans2M = models.IntegerField(blank=True, null=True, label='''答え''') ans2N = models.IntegerField(blank=True, null=True, label='''答え''') ans2O = models.IntegerField(blank=True, null=True, label='''答え''') ans2P = models.IntegerField(blank=True, null=True, label='''答え''') ans2Q = models.IntegerField(blank=True, null=True, label='''答え''') ans2R = models.IntegerField(blank=True, null=True, label='''答え''') ans2S = models.IntegerField(blank=True, null=True, label='''答え''') ans2T = models.IntegerField(blank=True, null=True, label='''答え''') def vars_for_admin_report(): ans2A = [ p.ans2A for p in self.get_players() ] ans2B = [ p.ans2B for p in self.get_players() ] ans2C = [ p.ans2C for p in self.get_players() ] ans2D = [ p.ans2D for p in self.get_players() ] ans2E = [ p.ans2E for p in self.get_players() ] ans2F = [ p.ans2F for p in self.get_players() ] ans2G = [ p.ans2G for p in self.get_players() ] ans2H = [ p.ans2H for p in self.get_players() ] ans2I = [ p.ans2I for p in self.get_players() ] ans2J = [ p.ans2J for p in self.get_players() ] ans2K = [ p.ans2K for p in self.get_players() ] ans2L = [ p.ans2L for l in self.get_players() ] ans2M = [ p.ans2M for p in self.get_players() ] ans2N = [ p.ans2N for p in self.get_players() ] ans2O = [ p.ans2O for p in self.get_players() ] ans2P = [ p.ans1P for p in self.get_players() ] ans2Q = [ p.ans1Q for p in self.get_players() ] ans2R = [ p.ans1R for p in self.get_players() ] ans2S = [ p.ans1S for p in self.get_players() ] ans2T = [ p.ans1T for p in self.get_players() ]