Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def confirmed_email_notification(sender, **kwargs):
- """
- Sends an email notification to the shop owner when a new order is
- completed.
- """
- print "EMAIL NOTIFICATION "
- subject_template_name = 'shop_simplenotifications/confirmed_subject.txt'
- body_template_name = 'shop_simplenotifications/confirmed_body.html'
- request = kwargs.get('request')
- order = kwargs.get('order')
- subject = loader.render_to_string(
- subject_template_name,
- RequestContext(request, {'order': order})
- )
- subject = subject.join(subject.splitlines())
- body = loader.render_to_string(
- body_template_name,
- RequestContext(request, {'order': order})
- )
- from_email = getattr(settings, 'SN_FROM_EMAIL',
- settings.DEFAULT_FROM_EMAIL)
- owners = getattr(settings, 'SN_OWNERS', settings.ADMINS)
- send_mail(subject, body, from_email,
- [owner[1] for owner in owners], fail_silently=False)
- print body
- print [owner[1] for owner in owners]
- confirmed.connect(confirmed_email_notification)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement