import random import time from ._builtin import Page, WaitPage class Welcome(Page): form_model = "player" form_fields = ["age", "gender", "phone_number", "i_agree"] def error_message(self, values): display = '' if not values.get('phone_number'): display = '.נא למלא מספר טלפון' if len(values.get('phone_number')) != 10: display = '.מספר טלפון נדרש להיות עם 10 ספרות' return display def before_next_page(self): self.participant.vars["phone_number"] = self.player.phone_number class Instructions1(Page): pass class Instructions2(Page): pass class Instructions3(Page): pass class Instructions4(Page): pass class Instructions5(Page): form_model = "player" form_fields = ["pre_test_q1", "pre_test_q2", "pre_test_q3"] def error_message(self, values): if not (values["pre_test_q1"] == "True" and values["pre_test_q2"] == "True" and values["pre_test_q3"] == "True"): return "אחת מהתשובות לא נכונות, יש לקרוא את ההוראות מחדש ולענות שוב" page_sequence = [Welcome, Instructions1, Instructions2, Instructions3, Instructions4, Instructions5]