そのため、私は Satchmo Store を使用しており、ウェブサイトでクーポンを購入する方法として商品券モジュールをセットアップしています。ただし、数量選択ページで複数購入した場合、購入した数に応じて複数のギフト券ではなく、1 つのギフト券のみがメールで送信されます。
これは、購入したギフト券がどのように電子メールで送信されるかのリスナーです。これについての洞察はありますか?
def coupon_notify(sender, instance, created, **kwargs):
recipient = instance.purchased_by.email
buyer = '%s %s' % (instance.purchased_by.first_name, instance.purchased_by.last_name)
subject = "You Coupon"
html_content = 'Your code:<br><strong style="font-size:40px; color:#000;">%s</strong>' % (instance.code)
sender = 'name@email.ca'
msg = EmailMessage(subject, html_content, sender, [recipient])
msg.content_subtype = "html"
msg.send()
def coupon_code_listener():
save_signals.post_save.connect(coupon_notify,\
sender=GiftCertificate,dispatch_uid="coupon_notify")