コード例 #1
0
ファイル: models.py プロジェクト: robftz/bizmodelcomp
    def send_invitation_email(self, judging_link):
        if not self.has_received_invite_email:
            self.has_received_invite_email = True
            self.save()

            subject = "Judging the %s" % self.competition.name
            message_markdown = """Hello,

You've been invited to help judge the %s. Judging will run from shortly after the application deadline at %s until as soon as all the applications have been assessed.

You can start judging at:

%s?e=%s

Thanks very much for the help!

Sincerely,
%s team""" % (self.competition.name,
              self.competition.current_phase.deadline,
              judging_link,
              self.email,
              self.competition.name)
        
            to_email = self.email

            send_email(subject, message_markdown, to_email)
        
        else:
            print "already sent judge invitation"
            pass
コード例 #2
0
ファイル: util.py プロジェクト: robftz/bizmodelcomp
def send_deadline_reminder_to_entrant(pitch):

    competition = pitch.phase.competition

    edit_pitch_link = "http://londonentrepreneurschallenge.nvana.com/apply/pitch/echallenge/?f=%s" % pitch.owner.anon_key().key

    to_email = pitch.owner.email.split(',')[0]
    subject = "6 hours left to edit your application"
    message = """Hello,

Thanks for applying to %s.

The deadline for Phase One submissions is 11:59pm tonight, October 31.

Remember that there are prizes of 2000 pounds for this phase of the competition, plus more to come later. You can keep editing and refining your pitch up until the deadline using this link:

%s

If you run into any problems or have questions about the application process, please feel free to respond to this email. 

Sincerely,

The %s team""" % (competition.name, edit_pitch_link, competition.name)

    send_email(subject, message, to_email)
コード例 #3
0
ファイル: views.py プロジェクト: robftz/bizmodelcomp
def recover_application(request, competition_url):

    competition = Competition.objects.get(hosted_url=competition_url)

    intro = SiteCopy.objects.get(id='recover_application_intro')
    security = SiteCopy.objects.get(id='recover_application_security')

    application_url = "/apply/pitch/%s/" % competition.hosted_url
    cancel = "<a href='%s'>Cancel and apply with a different email</a>" % application_url

    get_email = ""
    if request.method == "GET":
        get_email = request.GET.get("e")
        if not get_email:
            get_email = ""
        
    if request.method == "POST" and len(request.POST) > 0:

        try:
            #look for a founder w/ the matching email, and send them a note
            email = request.POST["email"]
            matching_founder = Founder.objects.get(email=email)

            subject = "Your application to %s" % competition.name

            application_url = request.build_absolute_uri("/apply/pitch/%s/?f=%s" % (competition.hosted_url, matching_founder.anon_key()))
    
            message = """Hello,

You're receiving this because you requested a reminder link for your application to %s!

You can use go here to edit your application any time until judging begins:
%s

Please feel free to respond to this email if you're still not able to access your application or if you have any other questions or confusion with using the site.

Sincerely,

The %s team""" % (competition.name, application_url, competition.name)
            
            message = """Click here to load & edit your application to %s:

%s""" % (competition.name, application_url)
            
            send_email(subject, message, email)

            return HttpResponseRedirect('/apply/sent_reminder/')
            
        except:
            #couldn't find a matching founder. tell person to apply now or re-type
            application_url = "/apply/pitch/%s/" % competition.hosted_url
            alert = """We couldn't find a matching email on file. If you might have registered with a different email, you can try that here.

Otherwise, <a href="%s">click here to go back to your new application</a>.""" % application_url
    
    return render_to_response('entercompetition/recover_application.html', locals())
コード例 #4
0
ファイル: util.py プロジェクト: robftz/bizmodelcomp
def send_verification_email(user, next_page):

    verification_key = None

    try:
        #only one per user. if we've already made one, send
        #a friendly reminder
        verification_key = VerificationKey.objects.get(user=user)
    except:

        #create unique random verification key. it's possible these loops
        #won't find one, but that's quite unlikely and 500ing seems less
        #risky potentially infinite looping
        for attempt in range(1, 1000):
            key = rand_key()
            print 'send veri email: key %s' % key
            try:
                
                verification_key = VerificationKey(key=key,
                                                   user = user)
                print 'made veri key'
                verification_key.save()
                print 'saved veri key'
                #if this hasn't thrown an exception, it's unique and we're
                #okay to quit searching
                print 'breakin'
                break
            
            except: pass
            
        else:
            print 'couldnt find unique valid key, aborting'
            #couldn't create a unique valid key for some reason
            return False

    verification_path = "/accounts/verify/%s/?next=%s" % (verification_key.key, next_page)
    verification_link = request.build_absolute_uri(verification_path)

    subject = "Verify your competition account"
    to_email = user.email
    message = """Hello,

To keep the competition pitches secure, we need you to confirm that this really is your email address, which you can do by using the link below. You'll then be taken to the page you were heading toward when you registered.

%s

Thanks very much, and please let us know (you can just reply to this email) if you have any questions or issues.

Stay well,
nvana""" % (verification_link)

    print 'sending email verify email'
    send_email(subject, message, to_email)

    return True
コード例 #5
0
ファイル: models.py プロジェクト: robftz/bizmodelcomp
    def send_judging_open_email(self, phase):

        if phase in self.received_phase_judging_open_emails_from.all():

            #already sent an alert, so do nothing
            return False

        else:
            try:
                #key already exists?
                verification_key = VerificationKey.objects.filter(email=self.email)[0]
                verification_key.is_verified=True
            except:
                #doesn't exist, make a new one pointing to the email that's pre-approved
                verification_key = VerificationKey(key=rand_key(),
                                                   user=None,
                                                   email=self.email,
                                                   is_verified=True)
            #in either case, save changes
            verification_key.save()
            
            judging_path = "/judge/?ev=%s" % key
            
            to_email = self.email
            subject = "Judging now open for %s" % self.competition.name
            message_markdown = """Hello,

Judging for %s is now open and will run until %s or as soon as all the applications have been assessed.

The link below will ask you to create an account and then take you to start judging submitted pitches. To ensure that we know who you are, please register with the same email address that this note is being sent to (%s).

%s

Your help as a judge is hugely appreciated. Please don't hesistate to reply if you have any questions, problems, or concerns.

Sincerely,

%s team""" % (self.competition.name,
              self.competition.current_phase().judging_close,
              self.email,
              judging_link,
              self.competition.name)
        
            
            send_email(subject, message_markdown, to_email)
コード例 #6
0
ファイル: views.py プロジェクト: robftz/bizmodelcomp
def send_welcome_email(request, founder, competition):

    to_email = founder.email
    subject = "Your application to %s" % competition.name
    application_url = request.build_absolute_uri("/a/%s/?t=%s" % (competition.hosted_url, founder.anon_key()))
    message = """Hello,

Thanks for applying to %s!

You can use go here to edit your application any time until judging begins:
%s

Please feel free to respond to this email with any questions or confusion with the application process.

Sincerely,

The %s team""" % (competition.name, application_url, competition.name)
                                               
    send_email(subject, message, to_email)