from otree.api import * doc = """ Your app description """ class C(BaseConstants): NAME_IN_URL = 'welcome' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass def creating_session(subsession): import itertools treatments = itertools.cycle( itertools.product([1, 2, 3, 4, 2, 1, 4, 3, 4, 2, 1, 3, 4, 1, 2, 3, 1, 3, 2, 4, 3, 1, 2, 4, 1, 2, 4, 3, 3, 4, 1, 2, 4, 1, 3, 2, 1, 3, 4, 2, 2, 1, 4, 3, 2, 3, 4, 1, 4, 2, 3, 1, 2, 4, 3, 1, 3, 2, 4, 1, 1, 4, 2, 3, 2, 1, 3, 4, 1, 4, 3, 2, 3, 4, 2, 1, 2, 3, 1, 4, 2, 4, 1, 3, 3, 2, 1, 4, 4, 3, 1, 2, 4, 3, 2, 1]) ) for player in subsession.get_players(): treatment = next(treatments) # print('treatment is', treatment) player.treat = treatment[0] class Group(BaseGroup): pass class Player(BasePlayer): treat = models.IntegerField() class welcome(Page): pass @staticmethod def app_after_this_page(player, upcoming_apps): print('upcoming_apps is', upcoming_apps) if player.treat == 3 or player.treat == 4: return "competition3" page_sequence = [welcome]