Python Satchmo礼券。购买多张礼券,只收到一个代码
所以我使用Satchmo商店,我有一个礼券模块,可以在我的网站上购买优惠券。但是,当我在“选择数量”页面上购买超过1份时,它只会向我发送一份礼券,而不会根据我购买的数量发送多份礼券 以下是购买礼券后如何通过电子邮件发送的听众。有人对此有所了解吗Python Satchmo礼券。购买多张礼券,只收到一个代码,python,django,certificate,satchmo,Python,Django,Certificate,Satchmo,所以我使用Satchmo商店,我有一个礼券模块,可以在我的网站上购买优惠券。但是,当我在“选择数量”页面上购买超过1份时,它只会向我发送一份礼券,而不会根据我购买的数量发送多份礼券 以下是购买礼券后如何通过电子邮件发送的听众。有人对此有所了解吗 def coupon_notify(sender, instance, created, **kwargs): recipient = instance.purchased_by.email buyer = '%s %s' % (inst
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")
我远不是这方面的专家,也没有与听众打交道的经验。。。但是我想说,侦听器只被调用一次,因为表单也只被发布/保存了一次。因此,也许您应该查找在模型实例上购买的优惠券数量,然后从那里继续发送多封邮件。。。或者,购买优惠券的数量反映了您被允许使用优惠券/代码的次数