from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Intro(Page): pass class Contribute(Page): form_model = 'player' form_fields = ['contribution'] class FirstWaitPage(WaitPage): pass class Punish(Page): form_model = 'player' form_fields = ['punish1', 'punish2'] def vars_for_template(self): others = self.player.get_others_in_group() #returns a list of the other two group members, ordered by ID in group return dict( contr1=others[0].contribution, contr2=others[1].contribution, ) class ResultsWaitPage(WaitPage): after_all_players_arrive = 'set_payoffs' class Results(Page): pass page_sequence = [Intro, Contribute, FirstWaitPage, Punish, ResultsWaitPage, Results]