from ._builtin import Page import random class Consent(Page): form_model = 'player' form_fields = ['consent', 'prolific_id', 'datum'] class End(Page): def is_displayed(self): return self.player.consent == 2 class Instructions(Page): def before_next_page(self): self.player.order = random.randint(1, 2) self.player.participant.vars['order'] = self.player.order self.player.similarity = random.randint(1, 2) self.player.participant.vars['similarity'] = self.player.similarity self.player.time_pressure = random.randint(1, 2) self.player.participant.vars['time_pressure'] = self.player.time_pressure self.player.treatment = random.randint(1, 2) self.player.participant.vars['treatment'] = self.player.treatment page_sequence = [ Consent, End, Instructions ]