from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants import random import re #from captcha.fields import ReCaptchaField class Instructions(Page): def vars_for_template(self): max_bonus = Constants.max_bonus return {'n_images' : Constants.n_images, 'n_questions': Constants.n_questions, 'max_bonus' : max_bonus} class Beliefs(Page): form_model = 'player' random.seed(11235) def get_form_fields(self): all_fields = ['b1', 'b2', 'b3', 'b4', 'b5', 'b6'] random.shuffle(all_fields) return all_fields def vars_for_template(self): image = self.participant.vars['images'] return {'img_to_show': image} class Instructions2(Page): def vars_for_template(self): max_bonus = Constants.max_bonus return {'n_images' : Constants.n_images, 'n_questions': Constants.n_questions, 'max_bonus' : max_bonus} class Perception(Page): form_model = 'player' random.seed(11235) def get_form_fields(self): all_fields = ['q1', 'q2', 'q3', 'q4', 'q5', 'q6'] random.shuffle(all_fields) return all_fields def vars_for_template(self): image = self.participant.vars['images'] return {'img_to_show': image} page_sequence = [ Instructions, Beliefs, Instructions2, Perception, ]