def send_quote_email (req, user, notes=""): ses = req.session seshelp = SessionHelper (ses) seshelp.update (req, called_from_cart=True) prod = Prod(ses.get ('prod', None)) dear = user.first_name or user.email notes = notes + (('\n\n' + prod.notes) if prod.notes else "") text = quote_product_request_email_template.format (dear=dear, u=user, s=settings, p=prod, notes=notes) # these lines add to cart before sending it - use with other template above, call from cart page: #html = '<html><body>%s</body></html>' % render_to_string ('_final_cart.html', context_instance=ctx) #ses ['cart'] = ses.get ('cart', []) + [prod] #ses ['prod'] = {} #html = seshelp.cart_details() #print 'SESHELP', seshelp.cart_summary(), seshelp.cart_details() quote_email_list = [user.email] + settings.ORDER_EMAIL msg = EmailMultiAlternatives ('Your %s eracks quote request' % settings.HNN[0], text, # nope: '', # let's try attaching the text, settings.ORDER_FROM_EMAIL, quote_email_list ) #msg.attach_alternative (html, "text/html") msg.send()
def send_quote_email(req, user): print 'send_quote_email' ses = req.session seshelp = SessionHelper (ses) seshelp.update (req, called_from_cart=True) prod = ses.get ('prod', None) text = quote_product_request_email_template.format (u=user, s=settings, p=Prod(prod)) # these lines add to cart before sending it - use with other template above, call from cart page: #html = '<html><body>%s</body></html>' % render_to_string ('_final_cart.html', context_instance=ctx) #ses ['cart'] = ses.get ('cart', []) + [prod] #ses ['prod'] = {} #html = seshelp.cart_details() #print 'SESHELP', seshelp.cart_summary(), seshelp.cart_details() quote_email_list = [user.email] + settings.ORDER_EMAIL msg = EmailMultiAlternatives ('Your %s eracks quote request' % settings.HNN[0], text, # nope: '', # let's try attaching the text, settings.ORDER_FROM_EMAIL, quote_email_list ) #msg.attach_alternative (html, "text/html") print 'send_quote_email' print 'haijaisjaisjak' print '****************settings.ORDER_FROM_EMAIL,' print user.email msg.send()
def add_to_cart (request): # called from here (deprecating) and from product view with redirect to /cart/, here ses = request.session post = request.POST #.dict() seshelp = SessionHelper (request.session) prod = ses.get ('prod', None) if prod: seshelp.update (request, called_from_cart=True) ses ['cart'] = ses.get ('cart', []) + [prod] ses ['prod'] = {}
def update_grid (request): ses_helper = SessionHelper (request.session) results = ses_helper.update (request) return HttpResponse (json.dumps (results), content_type='application/json')