from .models import * class Introduction(Page): form_model = 'player' class Send(Page): form_model = 'group' form_fields = ['sent_amount'] def is_displayed(self): group = self.group player = self.player return player.id_in_group == 1 class WaitForP1(WaitPage): pass class SendBack(Page): form_model = 'group' form_fields = ['sent_back_amount'] def is_displayed(self): group = self.group player = self.player return player.id_in_group == 2 def vars_for_template(self): group = self.group return dict(tripled_amount=group.sent_amount * Constants.multiplier) class ResultsWaitPage(WaitPage): after_all_players_arrive = 'set_payoffs' class Results(Page): form_model = 'player' page_sequence = [Introduction, Send, WaitForP1, SendBack, ResultsWaitPage, Results]