from __future__ import division from . import models from ._builtin import Page, WaitPage from random import choice from .models import Constants from otree.common import safe_json # this form should let you set the contribution class Informationletter(Page): pass class Informedconsent(Page): form_model = models.Player form_fields = ['ownname'] class Welcome(Page): pass class Welcome2(Page): pass class Instructions(Page): pass class Instructions_1(Page): pass class Instructions_2(Page): pass class Instructions_3(Page): pass class Instructions_4(Page): pass class Summary(Page): pass class Contribute(Page): form_model = models.Player form_fields = ['contribution', 'keep'] def error_message(self, values): if values["contribution"] + values["keep"] != Constants.endowment: return 'The numbers must add up to the endowment' class Beliefs(Page): form_model = models.Player form_fields = ['contributionothers', 'keepothers'] def error_message(self, values): if values["contributionothers"] + values["keepothers"] != 120: return 'The numbers must add up to the 120' class Comprehension(Page): form_model = models.Player form_fields = ['comprehension1', 'comprehension2'] class Demographics(Page): form_model = models.Player form_fields = ['country','age', 'gender', 'education1', 'education2', 'experience'] # wait page for othe participants class ResultsWaitPage(WaitPage): def after_all_players_arrive(self): self.group.set_payoffs() class Results(Page): pass # order of pages shown page_sequence = [ Informationletter, Informedconsent, Welcome, Welcome2, Instructions, Instructions_1, Instructions_2, Instructions_3, Instructions_4, Summary, Contribute, Beliefs, Comprehension, Demographics, ResultsWaitPage, Results ]