def expire_round(self, force=False): if not force and (self.closed or datetime.datetime.now() < self.expire_time): return self.closed = True if self.total_raised() >= self.max_amount*2 or self.donations.count() >= 3: self.failed = False self.secret_token = str(uuid.uuid4())[:40].replace('-', '') else: self.failed = True self.save() Emailer.round_over(self)
def invite_emails(request): round = get_object_or_404(Round, url=request.POST['round_id']) invites = request.POST['invites'] Emailer.email_invitees(round.absolute_url(), round.donations, round.expire_time, invites)