Django Oscar - email admin on order placed

我的未来我决定 提交于 2020-01-11 07:50:16

问题


I am trying to get django-oscar to send me an email everytime an order is placed. It sounds simple but I am struggling.

I have tried a couple of methods but all failed...

Is there an easy way?


回答1:


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

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



来源:https://stackoverflow.com/questions/55290850/django-oscar-email-admin-on-order-placed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!