コード例 #1
0
ファイル: admin.py プロジェクト: brajeshvit/virtual
    def save_model(self, request, order, form, change):
        instance = Order.objects.get(pk=order.pk)
        super(OrderAdmin, self).save_model(request, order, form, change)

        if instance.status != order.status:
            if order.status == Order.COMPLETED:
                completed.send(sender=self, order=order)
            elif order.status == Order.SHIPPED:
                shipped.send(sender=self, order=order)
            elif order.status == Order.CANCELLED:
                cancelled.send(sender=self, order=order)
コード例 #2
0
    def cancel(self, request):
        shop = self.shop
        order = shop.get_order(request)
        order_name = shop.get_order_short_name(order)
        order.status = Order.CANCELED
        order.save()

        # Empty the cart.
        try:
            cart = Cart.objects.get(pk=order.cart_pk)
            cart.empty()
        except Cart.DoesNotExist:
            pass

        cancelled.send(sender=self, order=order)
        return render(request, 'shop_wspay/cancel.html', {
            'order': order,
            'order_name': order_name,
        })
コード例 #3
0
    def cancel(self, request):
        shop = self.shop
        order = shop.get_order(request)
        order_name = shop.get_order_short_name(order)
        order.status = Order.CANCELED
        order.save()

        # Empty the cart.
        try:
            cart = Cart.objects.get(pk=order.cart_pk)
            cart.empty()
        except Cart.DoesNotExist:
            pass

        cancelled.send(sender=self, order=order)
        return render(request, 'shop_wspay/cancel.html', {
            'order': order,
            'order_name': order_name,
        })
コード例 #4
0
ファイル: api.py プロジェクト: kavefish/django-shop
 def cancel_payment(self, order, amount, payment_method, save=True):
     if save:
         order.status= Order.CANCELLED
         order.save()
     cancelled.send(sender=self, order=order)