registrasion/controllers/cart.py
def apply_voucher(self, voucher_code):
        ''' Applies the voucher with the given code to this cart. '''

        # Try and find the voucher
        voucher = inventory.Voucher.objects.get(code=voucher_code.upper())

        # Re-applying vouchers should be idempotent
        if voucher in self.cart.vouchers.all():
            return

        self._test_voucher(voucher)

        # If successful...
        self.cart.vouchers.add(voucher)
def apply_voucher(self, voucher_code):
        ''' Applies the voucher with the given code to this cart. '''

        # Try and find the voucher
        voucher = inventory.Voucher.objects.get(code=voucher_code.upper())

        # Re-applying vouchers should be idempotent
        if voucher in self.cart.vouchers.all():
            return

        self._test_voucher(voucher)

        # If successful...
        self.cart.vouchers.add(voucher)
def apply_voucher ( self , voucher_code ) : # Try and find the voucher voucher = inventory . Voucher . objects . get ( code = voucher_code . upper ( ) ) # Re-applying vouchers should be idempotent if voucher in self . cart . vouchers . all ( ) : return self . _test_voucher ( voucher ) # If successful... self . cart . vouchers . add ( voucher )
Applies the voucher with the given code to this cart.
Applies the voucher with the given code to this cart .