from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Registration(Page): form_model = 'player' form_fields = ['name'] def before_next_page(self): # Save player name and role into participant variable self.participant.vars['name'] = self.player.name self.participant.vars['role'] = self.player.role class Preference(Page): form_model = 'player' form_fields = ['preference'] def vars_for_template(self): import random # Define CI/MI Matrix cimi_text = [ ['id_cop_1', 'Your country needs to cooperate more with the United Nations and/or regional ' 'cooperation organizations.'], ['id_cop_2', 'It is essential for your country to work with other nations to solve problems ' 'such as overpopulation, hunger, and pollution.'], ['id_cop_3', 'Protecting the environment and ensuring universal access to safe, secure global ' 'common spaces (oceans, airspace, etc.) is of utmost importance.'], ['id_mil_1', 'Your country should take all steps including the use of force to prevent aggression ' 'by any expansionist power.'], ['id_mil_2', 'Rather than simply countering our opponents’ thrusts, it is necessary to strike at ' 'the heart of an opponent’s power.'], ['id_mil_3', 'It is sometimes necessary that your country must demonstrate its resolve so that ' 'others do not take advantage of it.'], ['id_neu_1', 'Your country should mind its own business internationally and, so long as they ' 'don’t threaten you, let other countries get along the best they can on their own.'], ['id_neu_2', 'Your country needs to play an active role in solving conflicts around the world.'], ['id_neu_3', 'Your country’s close partners are perfectly capable of defending themselves and ' 'they can afford it. Since they can defend themselves, they should; thus allowing us ' 'to focus on domestic issues rather than external problems.'] ] random.shuffle(cimi_text) return {'cimi': cimi_text} class Risk(Page): form_model = 'player' form_fields = ['risk'] class Knowledge(Page): form_model = 'player' form_fields = ['knowledge'] class Demographics(Page): form_model = 'player' form_fields = ['age', 'gender', 'education', 'political', 'computer', 'hospital' ] page_sequence = [ Registration, Preference, Risk, Knowledge, Demographics ]