示例#1
0
    def success(self, m):
        '''
            Does the necessary actions for a successful submission
            for contact.
        '''
        msg = """
                Someone has requested to be our merchant. Details as 
                follows:

                Name: %s
                Contact: %s
                Email: %s
                Company Name: %s

                Let's make his/her day. :)

                HO SAY AH!

              """ % ( m.name, m.contact_number, m.email, m.brand_name)
        r = default_mailer.post_message(
                "*****@*****.**",
                settings.SALES_TEAM_EMAILS,
                'Interested Merchant Alert',
                msg
                )
        if r.status_code >= 300:
            raise Exception('Merchant alert but no email sent!')
示例#2
0
 def post(self, request):
     form = ArdMerchantRequestForm(request.POST)
     if form.is_valid():
         m = form.save()
         cd = form.cleaned_data
         default_mailer.post_message(
                     "*****@*****.**",
                     settings.SALES_TEAM_EMAILS,
                     "Someone would like a merchant on around!",
                     self.success_email % (
                         cd['name'],
                         cd['email'],
                         cd['contact_number'],
                         cd['brand_name'],
                         cd['outlet_address'])
                     )
         return redirect(reverse('page-request-success'))
     context = dict(form=form)
     return render(request, self.template_name, context)