from ._builtin import Page, WaitPage from .models import Constants # Guessing the urn based on the drawn Ball class BayesianGuess(Page): form_model = 'player' form_fields = ['guess'] def vars_for_template(self): return dict( ball=self.participant.vars['ball'], ) def before_next_page(self): self.player.bayes() class ThankYou(Page): form_model = 'player' form_fields = ['age', 'female', 'ethnicity', 'degree', 'area', 'abc', 'cnn', 'fox', 'local', 'msnbc', 'npr', 'magazines', 'face', 'twit', 'other'] def before_next_page(self): self.player.filling_entries() class News(Page): def is_displayed(self): return self.player.magazines == 1 form_model = 'player' form_fields = ['economist', 'nyt', 'wsj', 'wash_ex', 'wash_pos', 'nature', 'science', 'other_2' ] class Results(Page): def vars_for_template(self): return dict( urn=self.player.urn, guess=self.player.guess ) page_sequence = [BayesianGuess, ThankYou, News, Results]