问题
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