mirumee / django-prices

Django fields for the prices module
158 stars 53 forks source link

Feature: multi-currency support #73

Closed Kwaidan00 closed 5 years ago

Kwaidan00 commented 5 years ago

Existing MoneyField has a major limitation - can store only one currency in the one table column. For most of the usages it is enough, but if user wants to store prices in many currencies, it leads to the problem. This PR adds new field, MoneyCurrencyField, which solves it. It stores amount of cash and currency in two table column. Existing users who don't need this feature could still use MoneyField.

Kwaidan00 commented 5 years ago

I've added those tests and change a bit validators, as I've written above.

rafalp commented 5 years ago

I've dropped some (not complete) wording suggestions to the readme.

On side note, could we start improving our test names to be more descriptive? There are 55 of those which may look like a lot, but I feel it may be last time when this can be done in a single swoop.

Eg. rename test_validate_max_money_different_currencies to test_max_money_validation_passes_if_greater_amount_is_in_different_currency? May look obnoxiously long, but will make assertions happening inside tests more obvious (and will steer us away from "this test touches many lines to it surely tests something!" attitude 😉)

Kwaidan00 commented 5 years ago

@rafalp I've changed some of the test names; the rest of them looks pretty fine for me, but I am open to discuss about it.