예제 #1
0
def close_campaigns():
    campaigns_last_day_today = Campaign.last_day_today()
    for campaign in campaigns_last_day_today:
        campaign.status = 'Closed'
        db.session.add(campaign)
        try:
          db.session.commit()
        except Exception as e:
          print e,"Unable to Commit"

        name = campaign.created_by.profile_name()
        campaign_title = campaign.title
        percent = campaign.percent_funded()

        text = 'Dear ' + name + ',\n\nWhat a ride that was! Your Donate-a-Book Campaign: ' + campaign_title + ' has officially come to an end.\n'+ 'You have raised ' + str(percent) + ' of your target fund. Congratulations on the success of your campaign. \n\nYou can expect to receive an email from the Pratham Books team which will have a comprehensive list of all books in stock. You would be able to pick and choose your preferred books priced within the fund limit that you have raised.\nKeep an eye out for our email, we will be in touch soon with more details. \n\nRegards, \nDonate-a-Book Team'
        send_email(to=campaign.emails(),
                subject="Congratulations on the success of your campaign!",
                text=text)
예제 #2
0
def close_campaigns():
    campaigns_last_day_today = Campaign.last_day_today()
    for campaign in campaigns_last_day_today:
        campaign.status = 'Closed'
        db.session.add(campaign)
        try:
            db.session.commit()
        except Exception as e:
            print e, "Unable to Commit"

        name = campaign.created_by.profile_name()
        campaign_title = campaign.title
        percent = campaign.percent_funded()

        text = 'Dear ' + name + ',\n\nWhat a ride that was! Your Donate-a-Book Campaign: ' + campaign_title + ' has officially come to an end.\n' + 'You have raised ' + str(
            percent
        ) + ' of your target fund. Congratulations on the success of your campaign. \n\nYou can expect to receive an email from the Pratham Books team which will have a comprehensive list of all books in stock. You would be able to pick and choose your preferred books priced within the fund limit that you have raised.\nKeep an eye out for our email, we will be in touch soon with more details. \n\nRegards, \nDonate-a-Book Team'
        send_email(to=campaign.emails(),
                   subject="Congratulations on the success of your campaign!",
                   text=text)