(sender, instance, *args, **kwargs)
订单保存前初始化订单参数
订单保存前初始化订单参数
订单保存前初始化订单参数
def on_order_created(sender, instance, *args, **kwargs):
    """订单保存前初始化订单参数"""
    if instance.time_expire is None:
        # 订单过期时间默认创建时间2小时后
        instance.time_expire = instance.time_start + tz.timedelta(hours=2)
def on_order_created ( sender , instance , * args , * * kwargs ) : if instance . time_expire is None : # 订单过期时间默认创建时间2小时后 instance . time_expire = instance . time_start + tz . timedelta ( hours = 2 )