from otree.api import Currency as c, currency_range from ._builtin import Page, WaitPage from .models import Constants class Donation(Page): form_model = 'player' form_fields = ['donation', 'other_donors_1', 'charitySelected'] def vars_for_template(self): return dict(treatment=self.participant.vars['treatment'], svo_angle=self.participant.vars['slider_angle']) def before_next_page(self): self.player.payoff = Constants.max_bonus - self.player.donation if self.player.donation == 0: self.player.charitySelected = 'NA' class DonationConfirmation(Page): form_model = 'player' form_fields = ['satisfaction', 'email', 'why_donation', 'why_satisfaction', 'distraction', 'other_donors', 'fairness', 'guilt', 'other_comments'] def vars_for_template(self): return dict(treatment=self.participant.vars['treatment']) def app_after_this_page(self, upcoming_apps): return 'conclusion' page_sequence = [Donation, DonationConfirmation]