You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It's not clear from the documentation that the "default currency" is considered to be index 0 of the CURRENCIES list. It might save others a bit of pdb'ing to figure out why they keep getting "exception not provided" when trying to add to cart something that isn't CHF. Perhaps a DEFAULT_CURRENCY setting that takes a 3-character currency string would be more explicit?
I'm also not certain that this error is normal, because even without modifying my CURRENCIES setting, Shouldn't I should by default be able to add products with a price set to be any of the 3-character currency strings provided by the default (CHF, CAD, USD, EUR) to my cart? I have no difficulty creating the product with say, USD as the currency in the admin. However, when I go to add it I get a "No exception supplied" DoesNotExist.
Changing my CURRENCIES setting to put USD as the first one gets me past the error, but it doesn't seem to be working as intended.
Any ideas Matthias?
EDIT: It seems that modifying the CURRENCIES list did not solve the issue. Pdb reveals that "currency" is always None in get_currency() of ProductBase, which does not seem to be intended behavior. Also, orderitem.currency() seems to only return "CHF", despite the product having a price specified in USD. I'm going to clear out .pyc's and the database to see if that solves it.
EDIT: OK, after removing all .pyc and dropping/recreating the database I think the problem seems to be the following: Say I have CURRENCIES = ("USD", "CHF", "EUR", "CAD"), and I create a product with a price in USD. I am able to proceed normally with adding to the cart and completing an order. However, if I create a product with a price in CHF, EUR, or CAD, attempting to add to the cart fails with a DoesNotExist exception.
FINAL EDIT: So it seems that in order to have multiple currencies, you need to override default_currency() on your Shop instance and provide the functionality yourself. Perfectly reasonable now that I know, but the documentation should probably reflect that the first currency listed in CURRENCIES is the only one that will work out-of-the-box without overriding the default implementation of default_currency().
The text was updated successfully, but these errors were encountered:
It's not clear from the documentation that the "default currency" is considered to be index 0 of the CURRENCIES list. It might save others a bit of pdb'ing to figure out why they keep getting "exception not provided" when trying to add to cart something that isn't CHF. Perhaps a DEFAULT_CURRENCY setting that takes a 3-character currency string would be more explicit?
I'm also not certain that this error is normal, because even without modifying my CURRENCIES setting, Shouldn't I should by default be able to add products with a price set to be any of the 3-character currency strings provided by the default (CHF, CAD, USD, EUR) to my cart? I have no difficulty creating the product with say, USD as the currency in the admin. However, when I go to add it I get a "No exception supplied" DoesNotExist.
Changing my CURRENCIES setting to put USD as the first one gets me past the error, but it doesn't seem to be working as intended.
Any ideas Matthias?
EDIT: It seems that modifying the CURRENCIES list did not solve the issue. Pdb reveals that "currency" is always None in get_currency() of ProductBase, which does not seem to be intended behavior. Also, orderitem.currency() seems to only return "CHF", despite the product having a price specified in USD. I'm going to clear out .pyc's and the database to see if that solves it.
EDIT: OK, after removing all .pyc and dropping/recreating the database I think the problem seems to be the following: Say I have CURRENCIES = ("USD", "CHF", "EUR", "CAD"), and I create a product with a price in USD. I am able to proceed normally with adding to the cart and completing an order. However, if I create a product with a price in CHF, EUR, or CAD, attempting to add to the cart fails with a DoesNotExist exception.
FINAL EDIT: So it seems that in order to have multiple currencies, you need to override default_currency() on your Shop instance and provide the functionality yourself. Perfectly reasonable now that I know, but the documentation should probably reflect that the first currency listed in CURRENCIES is the only one that will work out-of-the-box without overriding the default implementation of default_currency().
The text was updated successfully, but these errors were encountered: