The wording of the error is: "Error binding parameter 1 - probably unsupported type."
What am I doing wrong? I'm pretty sure my code is the same as the example.
from satchmo_store.shop.exceptions import CartAddProhibited
from django.utils.translation import gettext_lazy as _
class ContactCannotOrder(CartAddProhibited):
def __init__(self, contact, product, msg):
super(ContactCannotOrder, self).__init__(product, msg)
self.contact = contact
def can_user_buy(product, contact=None):
return False # If I make this 'True' then obviously it works fine.
def veto_if_already_purchased(sender, cartitem=None, added_quantity=0, **kwargs):
customer = kwargs['cart'].customer
if can_user_buy(cartitem.product, customer):
return True
else:
msg = _("You have already purchased this.")
raise ContactCannotOrder(customer, cartitem.product, msg)