from otree.api import * doc = """Detect and block mobile browsers""" class C(BaseConstants): NAME_IN_URL = 'detect_mobile' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 class Subsession(BaseSubsession): pass class Group(BaseGroup): pass class Player(BasePlayer): is_mobile = models.BooleanField() # PAGES class MobileCheck(Page): form_model = 'player' form_fields = ['is_mobile'] class DeviceCompatibilityDrop(Page): def is_displayed(player: Player): return player.is_mobile def vars_for_template(self): return { 'redirect_url': self.session.config['incompatible_device_dropout'] } page_sequence = [MobileCheck, DeviceCompatibilityDrop]