from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Intro(Page): def is_displayed(self): return self.round_number in Constants.switching_rounds class Contribution(Page): form_model = 'player' form_fields = ['contribution'] def vars_for_template(self): # define variables that we use later on our page return {'mylabel': f'Invest something from 0 to {Constants.endowment}'} def contribution_max(self): # define a dynamic maximum contribution return self.player.endowment class ResultsWaitPage(WaitPage): def after_all_players_arrive(self): self.group.set_payoffs() class Results(Page): pass class FinalResults(Page): def is_displayed(self): return self.round_number == Constants.num_rounds page_sequence = [ Intro, Contribution, ResultsWaitPage, Results, FinalResults ]