Django Oscar - 发送订单的电子邮件管理员

问题描述 投票:0回答:1

我想让django-oscar每次下订单时都给我发电子邮件。听起来很简单,但我很挣扎。

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

有一个简单的方法吗?

python django django-oscar
1个回答
3
投票

您可以为order_placed信号设置一个监听器,然后执行您想要的任何操作。

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

或者,分叉orders应用程序并覆盖OrderCreator类以在下订单时注入额外的逻辑。

© www.soinside.com 2019 - 2024. All rights reserved.