class Group(BaseGroup): # variables that change for each group treatment_endowment = models.IntegerField() treatment_treatment = models.TextField() a_takes = models.DecimalField(min=0, max=100, max_digits=5, decimal_places=2) total_taken = models.CurrencyField() b_predicts = models.PositiveIntegerField(min=0, max=100) b_willing = models.DecimalField(min=0, max_digits=6, decimal_places=3) b_message = models.TextField() b_message_price = models.DecimalField(max_digits=5, decimal_places=2) price_method = models.TextField() price_display = models.TextField() b_eligible = models.BooleanField() target_income = models.DecimalField(max_digits=5, decimal_places=2) reader_index = models.IntegerField() def final_pay(self): p1 = self.get_player_by_id(1) p2 = self.get_player_by_id(2) p1.final_reward = self.treatment_endowment+ p1.task_reward + self.total_taken if self.price_method != 'WTA': if self.b_eligible: p2.final_reward = self.treatment_endowment+ p2.task_reward - self.total_taken - self.b_message_price else: p2.final_reward = self.treatment_endowment + p2.task_reward - self.total_taken else: # WTA if self.b_eligible: p2.final_reward = self.treatment_endowment + p2.task_reward - self.total_taken else: # gave up right to send message p2.final_reward = self.treatment_endowment + p2.task_reward - self.total_taken + self.b_message_price def reader_pay(self): for p in self.get_players(): p.final_reward = self.treatment_endowment + p.task_reward
class Group(otree.models.BaseGroup): total_contribution = models.DecimalField( max_digits=12, decimal_places=2, doc="The total amount the group contribted for the round") individual_share = models.DecimalField( max_digits=12, decimal_places=2, doc="The total_contribution divided by 4") efficiency_rate = models.DecimalField(max_digits=12, decimal_places=2, doc="This is the groups true MPCR") def old_set_efficiency_rate(self): if self.subsession.round_number == 1: newMpcr = round(random.choice(Constants.efficiency_factors), 2) else: player = self.get_players()[0] for f in player.in_all_rounds(): if f.subsession.round_number == 1: newMpcr = f.group.efficiency_rate self.efficiency_rate = newMpcr def set_efficiency_rate(self): pastMpcrs = [] player = self.get_players()[0] for f in player.in_all_rounds(): pastMpcrs.append(f.group.efficiency_rate) newMpcr = False while not newMpcr: number = random.choice(Constants.MPCRS) if pastMpcrs.count(number) < 2: newMpcr = number self.efficiency_rate = newMpcr def set_payoffs(self): # add some logic here to add up contributions # from rounds 1-10, 11-20, 21-30 x = self.session.vars['paying_round'] self.total_contribution = sum( [p.contribution for p in self.get_players()]) self.individual_share = self.total_contribution * self.efficiency_rate for p in self.get_players(): p.round_points = (Constants.endowment - p.contribution) + self.individual_share p.payoff = 0
class Group(BaseGroup): total_extraction = models.DecimalField(max_digits=2, decimal_places=0) total_payment = models.CurrencyField() group_loss = models.CurrencyField() def set_payoffs(self): self.total_extraction = sum([p.extraction for p in self.get_players()]) self.group_loss = Constants.beta_factor * ( Constants.players_per_group * Constants.endowment - self.total_extraction) for p in self.get_players(): p.payoff = p.extraction + self.group_loss self.total_payment = sum([p.payoff for p in self.get_players()]) if self.id_in_subsession == 1: for p in self.get_players(): p.aux_2_1 = 1 p.aux_2_2 = 0 p.aux_2_3 = 0 if self.id_in_subsession == 2: for p in self.get_players(): p.aux_2_1 = 0 p.aux_2_2 = 1 p.aux_2_3 = 0 if self.id_in_subsession == 3: for p in self.get_players(): p.aux_2_1 = 0 p.aux_2_2 = 0 p.aux_2_3 = 1
class Player(BasePlayer): # variables that change for each player task_reward = models.DecimalField(max_digits=5, decimal_places=2) intermediate_reward = models.DecimalField(max_digits=5, decimal_places=2) final_reward = models.DecimalField(max_digits=5, decimal_places=2) total_pay = models.DecimalField(max_digits=5, decimal_places=2) p_role = models.TextField() survey_response0 = models.IntegerField() survey_response1 = models.IntegerField() survey_response2 = models.IntegerField() survey_response3 = models.IntegerField() survey_response4 = models.IntegerField() survey_response5 = models.IntegerField() survey_responseA = models.IntegerField() survey_responseB = models.IntegerField() survey_responseC = models.IntegerField() survey_responseD = models.IntegerField() survey_responseE = models.IntegerField() survey_responseF = models.IntegerField() def get_partner(self): return self.get_others_in_group()[0]
class Player(BasePlayer): extraction = models.DecimalField( max_digits=2, decimal_places=0, min=0, max=Constants.endowment, choices=[0, 1, 2, 3, 4, 5], doc="""The amount extracted by the player""", ) partial_pay = models.CurrencyField() ranking = models.DecimalField(max_digits=2, decimal_places=0) auxiliar = models.PositiveIntegerField() aux_2_1 = models.DecimalField(max_digits=2, decimal_places=0) aux_2_2 = models.DecimalField(max_digits=2, decimal_places=0) aux_2_3 = models.DecimalField(max_digits=2, decimal_places=0) gp_ranking = models.DecimalField(max_digits=2, decimal_places=0) def the_ranking(self): self.auxiliar = self.participant_id if self.auxiliar == self.subsession.posit_1: self.ranking = self.subsession.rank_p_1 elif self.auxiliar == self.subsession.posit_2: self.ranking = self.subsession.rank_p_2 elif self.auxiliar == self.subsession.posit_3: self.ranking = self.subsession.rank_p_3 elif self.auxiliar == self.subsession.posit_4: self.ranking = self.subsession.rank_p_4 elif self.auxiliar == self.subsession.posit_5: self.ranking = self.subsession.rank_p_5 elif self.auxiliar == self.subsession.posit_6: self.ranking = self.subsession.rank_p_6 elif self.auxiliar == self.subsession.posit_7: self.ranking = self.subsession.rank_p_7 elif self.auxiliar == self.subsession.posit_8: self.ranking = self.subsession.rank_p_8 elif self.auxiliar == self.subsession.posit_9: self.ranking = self.subsession.rank_p_9 elif self.auxiliar == self.subsession.posit_10: self.ranking = self.subsession.rank_p_10 elif self.auxiliar == self.subsession.posit_11: self.ranking = self.subsession.rank_p_11 elif self.auxiliar == self.subsession.posit_12: self.ranking = self.subsession.rank_p_12
class Subsession(BaseSubsession): multi_uno = models.DecimalField(max_digits=3, decimal_places=2) multi_dos = models.DecimalField(max_digits=3, decimal_places=2) multi_tres = models.DecimalField(max_digits=3, decimal_places=2) multi_cuatro = models.DecimalField(max_digits=3, decimal_places=2) multi_cinco = models.DecimalField(max_digits=3, decimal_places=2) rank_uno = models.DecimalField(max_digits=2, decimal_places=0) rank_dos = models.DecimalField(max_digits=2, decimal_places=0) rank_tres = models.DecimalField(max_digits=2, decimal_places=0) rank_cuatro = models.DecimalField(max_digits=2, decimal_places=0) rank_cinco = models.DecimalField(max_digits=2, decimal_places=0) rank_p_1 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_2 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_3 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_4 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_5 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_6 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_7 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_8 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_9 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_10 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_11 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_12 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_13 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_14 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_15 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_16 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_17 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_18 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_19 = models.DecimalField(max_digits=2, decimal_places=0) rank_p_20 = models.DecimalField(max_digits=2, decimal_places=0) posit_1 = models.PositiveIntegerField() posit_2 = models.PositiveIntegerField() posit_3 = models.PositiveIntegerField() posit_4 = models.PositiveIntegerField() posit_5 = models.PositiveIntegerField() posit_6 = models.PositiveIntegerField() posit_7 = models.PositiveIntegerField() posit_8 = models.PositiveIntegerField() posit_9 = models.PositiveIntegerField() posit_10 = models.PositiveIntegerField() posit_11 = models.PositiveIntegerField() posit_12 = models.PositiveIntegerField() posit_13 = models.PositiveIntegerField() posit_14 = models.PositiveIntegerField() posit_15 = models.PositiveIntegerField() posit_16 = models.PositiveIntegerField() posit_17 = models.PositiveIntegerField() posit_18 = models.PositiveIntegerField() posit_19 = models.PositiveIntegerField() posit_20 = models.PositiveIntegerField() max_pay = models.DecimalField(max_digits=3, decimal_places=1) min_pay = models.DecimalField(max_digits=3, decimal_places=1) max_fund = models.DecimalField(max_digits=3, decimal_places=1) min_fund = models.DecimalField(max_digits=3, decimal_places=1) def before_session_starts(self): if self.round_number == 1: players = self.get_players() random.shuffle(players) group_matrix = [] ppg = Constants.players_per_group for i in range(0, len(players), ppg): group_matrix.append(players[i:i+ppg]) self.set_groups(group_matrix) if self.round_number > 1: self.group_like_round(1) def set_ranking_g(self): self.max_fund = max([(Constants.endowment*Constants.players_per_group-p.total_extraction) for p in self.get_groups()]) self.min_fund = min([(Constants.endowment*Constants.players_per_group-p.total_extraction) for p in self.get_groups()]) vector_group = [(50-p.total_payment) for p in self.get_groups()] vector_ranked_g = ranking.rankdata(vector_group) coefficients = [1.10 - (a-1)*(0.05) for a in vector_ranked_g] self.multi_uno = coefficients[0] self.multi_dos = coefficients[1] self.multi_tres = coefficients[2] self.multi_cuatro = coefficients[3] self.multi_cinco = coefficients[4] zeq = sorted (vector_group) indez = [zeq.index(v) for v in vector_group] vector_indez = [w + 1 for w in indez] self.rank_uno = vector_indez[0] self.rank_dos = vector_indez[1] self.rank_tres = vector_indez[2] self.rank_cuatro = vector_indez[3] self.rank_cinco = vector_indez[4] for p in self.get_players(): a1 = float(p.aux_2_1) a2 = float(p.aux_2_2) a3 = float(p.aux_2_3) a4 = float(p.aux_2_4) a5 = float(p.aux_2_5) p.payoff = p.payoff*self.multi_uno*p.aux_2_1 + p.payoff*self.multi_dos*p.aux_2_2 + p.payoff*self.multi_tres*p.aux_2_3 + + p.payoff*self.multi_cuatro*p.aux_2_4 + p.payoff*self.multi_cinco*p.aux_2_5 p.gp_ranking = self.rank_uno*a1 + self.rank_dos*a2 + self.rank_tres*a3 + self.rank_cuatro*a4 + self.rank_cinco*a5 self.max_pay = max([p.payoff for p in self.get_players()]) self.min_pay = min([p.payoff for p in self.get_players()]) vector_players = [(30-p.payoff) for p in self.get_players()] vector_positions = [p.participant_id for p in self.get_players()] seq = sorted(vector_players) index = [seq.index(v) for v in vector_players] vector_ranked_p = [w + 1 for w in index] self.rank_p_1 = vector_ranked_p[0] self.rank_p_2 = vector_ranked_p[1] self.rank_p_3 = vector_ranked_p[2] self.rank_p_4 = vector_ranked_p[3] self.rank_p_5 = vector_ranked_p[4] self.rank_p_6 = vector_ranked_p[5] self.rank_p_7 = vector_ranked_p[6] self.rank_p_8 = vector_ranked_p[7] self.rank_p_9 = vector_ranked_p[8] self.rank_p_10 = vector_ranked_p[9] self.rank_p_11 = vector_ranked_p[10] self.rank_p_12 = vector_ranked_p[11] self.rank_p_13 = vector_ranked_p[12] self.rank_p_14 = vector_ranked_p[13] self.rank_p_15 = vector_ranked_p[14] self.rank_p_16 = vector_ranked_p[15] self.rank_p_17 = vector_ranked_p[16] self.rank_p_18 = vector_ranked_p[17] self.rank_p_19 = vector_ranked_p[18] self.rank_p_20 = vector_ranked_p[19] self.posit_1 = vector_positions[0] self.posit_2 = vector_positions[1] self.posit_3 = vector_positions[2] self.posit_4 = vector_positions[3] self.posit_5 = vector_positions[4] self.posit_6 = vector_positions[5] self.posit_7 = vector_positions[6] self.posit_8 = vector_positions[7] self.posit_9 = vector_positions[8] self.posit_10 = vector_positions[9] self.posit_11 = vector_positions[10] self.posit_12 = vector_positions[11] self.posit_13 = vector_positions[12] self.posit_14 = vector_positions[13] self.posit_15 = vector_positions[14] self.posit_16 = vector_positions[15] self.posit_17 = vector_positions[16] self.posit_18 = vector_positions[17] self.posit_19 = vector_positions[18] self.posit_20 = vector_positions[19]
class Player(otree.models.BasePlayer): treatment = models.IntegerField( doc= "The player's treatment; identical to subsession.treatment. See public_goods doc for description" ) contribution = models.DecimalField( min=0, max=Constants.endowment, doc="""The amount contributed by the player""", max_digits=12, decimal_places=2, ) signal = models.DecimalField( max_digits=12, decimal_places=2, doc="The MPCR observed by the subject for the given round") round_points = models.DecimalField( max_digits=12, decimal_places=2, doc= "This is the total points (tokens) for the subject for a given round. It includes the points from the public good (one forth of the total points present in the public good plus tokens present in the private account). Notice that points/payoff for any given round will be materially paid to subjects at the end of the experiment only if the game that includes that round is randomly selected for payment." ) def set_signal_value(self): mpcr = self.group.efficiency_rate signalVariance = self.session.config['signalVariance'] choicesLeft = [ mpcr - Decimal(x * .1) for x in range(1, signalVariance + 1) ] choicesRight = [ mpcr + Decimal(x * .1) for x in range(1, signalVariance + 1) ] #chop off choices if at the tail if mpcr < Decimal(.06): choices = choicesRight + [mpcr] elif Decimal(.06) < mpcr < Decimal(.16) and signalVariance == 2: choices = choicesRight + [mpcr] + choicesLeft[:1] elif mpcr > Decimal(1.16): choices = choicesLeft + [mpcr] elif Decimal(1.06) < mpcr < Decimal(1.16) and signalVariance == 2: choices = choicesLeft + [mpcr] + choicesRight[:1] else: choices = [mpcr] + choicesLeft + choicesRight signal = random.choice(choices) self.signal = signal.quantize(Decimal('.01')) def get_signal_values(self): if self.session.config['signalVariance'] == 2: signalVariance = Decimal(.2) else: signalVariance = Decimal(.1) left = self.signal - signalVariance right = self.signal + signalVariance signals = dict(left=left.quantize(Decimal('.01')), right=right.quantize(Decimal('.01'))) return signals def set_image(self): playerimage = PlayerImage(participant_id=self.participant.id, image=self.image) playerimage.save() def get_game_info(self): for p in self.in_all_rounds(): if p.subsession.round_number == 1: info = [] info.append(p) return info def get_game_payoffs(self): payoffs = [] for p in self.in_all_rounds(): payoffs.append(p.round_points) def get_round_period(self): x = 1 for r in [1]: if self.subsession.round_number in range( r, r + Constants.rounds_per_game): game_round = self.subsession.round_number - r break else: x += 1 return [game_round + 1, x]
class Player(otree.models.BasePlayer): risk_points = models.DecimalField(max_digits=12, decimal_places=2) GAMBLES = ( ('1', "Gamble 1"), ('2', "Gamble 2"), ('3', "Gamble 3"), ('4', "Gamble 4"), ('5', "Gamble 5"), ) URNS = ( ('0', "Black: ? | White: ?"), ('1', "Black:50% | White:50%"), ) COLORS = ( ('0', "Black"), ('1', "White"), ) risk_flip = models.IntegerField( doc="The flip chosen by the computer. 0:Heads 1: Tails") risk_choice = models.CharField( initial=None, choices=GAMBLES, verbose_name="Choose the gamble you to play", doc= "The coinflip gamble the subject wants to play. Variable takes value 1,...,5 which correspond to Gamble 1, ..., Gamble 5." ) risk_payoff = models.DecimalField(max_digits=12, decimal_places=2) amb_chosen_game = models.CharField( doc="The game randomly choosen by the computer among the ten available." ) amb_chosen_ball = models.CharField( doc="The ball chosen by the computer; 0: Black,1: White") amb_payoff = models.DecimalField(max_digits=12, decimal_places=2) amb_points = models.DecimalField(max_digits=12, decimal_places=2) amb_choice1_urn = models.CharField( initial=None, choices=URNS, ) amb_choice1_color = models.CharField( initial=None, choices=COLORS, widget=widgets.RadioSelectHorizontal(), verbose_name="") amb_choice2_urn = models.CharField( initial=None, choices=URNS, ) amb_choice2_color = models.CharField( initial=None, choices=COLORS, widget=widgets.RadioSelectHorizontal(), verbose_name="") amb_choice3_urn = models.CharField( initial=None, choices=URNS, ) amb_choice3_color = models.CharField( initial=None, choices=COLORS, widget=widgets.RadioSelectHorizontal(), verbose_name="") amb_choice4_urn = models.CharField( initial=None, choices=URNS, ) amb_choice4_color = models.CharField( initial=None, choices=COLORS, widget=widgets.RadioSelectHorizontal(), verbose_name="") amb_choice5_urn = models.CharField( initial=None, choices=URNS, ) amb_choice5_color = models.CharField( initial=None, choices=COLORS, widget=widgets.RadioSelectHorizontal(), verbose_name="") amb_choice6_urn = models.CharField( initial=None, choices=URNS, ) amb_choice6_color = models.CharField( initial=None, choices=COLORS, widget=widgets.RadioSelectHorizontal(), verbose_name="") amb_choice7_urn = models.CharField( initial=None, choices=URNS, ) amb_choice7_color = models.CharField( initial=None, choices=COLORS, widget=widgets.RadioSelectHorizontal(), verbose_name="") amb_choice8_urn = models.CharField( initial=None, choices=URNS, ) amb_choice8_color = models.CharField( initial=None, choices=COLORS, widget=widgets.RadioSelectHorizontal(), verbose_name="") amb_choice9_urn = models.CharField( initial=None, choices=URNS, ) amb_choice9_color = models.CharField( initial=None, choices=COLORS, widget=widgets.RadioSelectHorizontal(), verbose_name="") amb_choice10_urn = models.CharField( initial=None, choices=URNS, ) amb_choice10_color = models.CharField( initial=None, choices=COLORS, widget=widgets.RadioSelectHorizontal(), verbose_name="") def get_chosen_urn(self): urn = getattr(self, "amb_choice{}_urn".format(self.amb_chosen_game)) if urn == "0": u = "Black: ? | White: ?" else: u = "Black: 50% | White: 50%" return u def get_chosen_color(self): color = getattr(self, "amb_choice{}_color".format(self.amb_chosen_game)) if color == "0": c = "Black" else: c = "White" return c def get_drawn_color(self): if self.amb_chosen_ball == "0": color = "Black" else: color = "White" return color def set_amb_payoffs(self): self.amb_chosen_game = random.choice(range(1, 11)) gamble = Constants.URNDICT[str(self.amb_chosen_game)] urn = getattr(self, "amb_choice{}_urn".format(self.amb_chosen_game)) color = getattr(self, "amb_choice{}_color".format(self.amb_chosen_game)) self.amb_chosen_ball = random.choice(Constants.URNS[str(urn)]) if self.amb_chosen_ball == color: self.amb_points = gamble[int(urn)] self.amb_payoff = self.amb_points * self.session.real_world_currency_per_point else: self.amb_points = 0 self.amb_payoff = 0 self.participant.vars['amb_points'] = self.amb_points self.participant.vars['amb_payoff'] = self.amb_payoff def set_risk_payoffs(self): flip = random.choice([0, 1]) self.risk_flip = flip result = Constants.RISKDICT[self.risk_choice] self.risk_points = result[flip] self.risk_payoff = Decimal( result[flip]) * self.session.real_world_currency_per_point self.participant.vars['risk_points'] = self.risk_points self.participant.vars['risk_payoff'] = self.risk_payoff def set_payoffs(self): self.payoff = sum([self.risk_payoff, self.amb_payoff]) def flipcoin(self): result = random.choice([0, 1]) self.risk_flip = result def get_form_fields(self): form_fields = [] for x in range(1, len(Constants.URNDICT) + 1): form_fields.append("amb_choice{}_urn".format(x)) form_fields.append("amb_choice{}_color".format(x)) return form_fields
class Player(BasePlayer): #defining quantity vars CashQuantity = models.IntegerField(initial=0) MasonMoneyQuantity = models.IntegerField(initial=0) BarnesNobleQuantity = models.IntegerField(initial=0) FandangoQuantity = models.IntegerField(initial=0) GapQuantity = models.IntegerField(initial=0) #defining price vars CashPrice = models.DecimalField(..., max_digits=5, decimal_places=1, default=0) MasonMoneyPrice = models.DecimalField(..., max_digits=5, decimal_places=1, default=0) BarnesNoblePrice = models.DecimalField(..., max_digits=5, decimal_places=1, default=0) FandangoPrice = models.DecimalField(..., max_digits=5, decimal_places=1, default=0) GapPrice = models.DecimalField(..., max_digits=5, decimal_places=1, default=0) #defining spending vars CashSpending = models.DecimalField(..., max_digits=5, decimal_places=1, default=0) MasonMoneySpending = models.DecimalField(..., max_digits=5, decimal_places=1, default=0) BarnesNobleSpending = models.DecimalField(..., max_digits=5, decimal_places=1, default=0) FandangoSpending = models.DecimalField(..., max_digits=5, decimal_places=1, default=0) GapSpending = models.DecimalField(..., max_digits=5, decimal_places=1, default=0) Expenditure = models.DecimalField(..., max_digits=5, decimal_places=1, default=0) def compute_spendings(self): self.CashSpending = self.CashPrice * decimal.Decimal(self.CashQuantity) self.MasonMoneySpending = self.MasonMoneyPrice * decimal.Decimal( self.MasonMoneyQuantity) self.BarnesNobleSpending = self.BarnesNoblePrice * decimal.Decimal( self.BarnesNobleQuantity) self.FandangoSpending = self.FandangoPrice * decimal.Decimal( self.FandangoQuantity) self.GapSpending = self.GapPrice * decimal.Decimal(self.GapQuantity) self.Expenditure = self.CashSpending + self.MasonMoneySpending + self.BarnesNobleSpending + self.FandangoSpending + self.GapSpending def set_prices(self): self.CashPrice = random.randint(5, 30) / 2 self.MasonMoneyPrice = 17.5 - self.CashPrice self.FandangoPrice = random.randrange(5, 14) / 2 self.BarnesNoblePrice = random.randrange(5, 20) / 2 self.GapPrice = 12.5 - self.BarnesNoblePrice #questionnaires Q1 = models.CharField(choices=['Yes', 'No'], widget=widgets.RadioSelect()) Q2 = models.CharField(choices=['Yes', 'No'], widget=widgets.RadioSelect()) Q3 = models.CharField(choices=['Yes', 'No'], widget=widgets.RadioSelect()) Q4 = models.CharField(choices=['Yes', 'No'], widget=widgets.RadioSelect()) Q5 = models.CharField(choices=['Yes', 'No'], widget=widgets.RadioSelect()) Gender = models.CharField(choices=[('M', 'Male'), ('F', 'Female')], default='M') Age = models.IntegerField(min=18, max=99) ShareFood = models.CurrencyField(min=0, max=100) ShareBooks = models.CurrencyField(min=0, max=100) ShareCloths = models.CurrencyField(min=0, max=100) ShareMovies = models.CurrencyField(min=0, max=100) AllArrived = models.IntegerField(initial=0) def all_arrive(self): AllArrived = 1