Django Oscar - 下订单时的电子邮件管理员

Hyu*_*Han 1 python django django-oscar

我试图让 django-oscar 在每次下订单时向我发送电子邮件。这听起来很简单,但我很挣扎。

我尝试了几种方法,但都失败了......

有没有简单的方法?

sol*_*oke 5

You can set up a listener for the order_placed signal, and then do whatever actions you want there.

from django.dispatch import receiver

from oscar.apps.order.signals import order_placed

@receiver(order_placed)
def send_merchant_notification(sender, order, user, **kwargs):
    # Do stuff here
Run Code Online (Sandbox Code Playgroud)

Alternatively, fork the orders app and override the OrderCreator class to inject additional logic when an order is placed.