Changelog

Unreleased (TBA)

Added

  • (add entry here)

Fixed

  • (add entry here)

Changed

  • Don’t register Django Money serializers by default, instead the user should actively register a serializer in the settings.py #636 (emorozov)

3.3 - 2023-09-10

Fixed

  • Fix detection of necessary migrations. Note that this means that previously undetected migrations will be detected as of this version #725 (vanschelven)

3.2 - 2023-07-03

Changed

  • Explicitly define id in djmoney.contrib.exchange.Rate model - This ensures that the database table will use AutoField even if DEFAULT_AUTO_FIELD is set to BigAutoField in the Django project’s settings #716

Fixed

  • Downgrade asgiref to 3.6 to work with pypy3

3.1 - 2023-04-20

Added

Fixed

  • Support for Money type with Coalesce in QuerySet.update() #678 (stianjensen)

  • pre-commit config for moved flake8 repo (sdarmofal)

  • Use latest setup-python GitHub Action #692 (sondrelg)

  • Optimize: Rate is always 1 if source and target are equal #689 (nschlemm)

  • Fixer.io backend: Avoid 403 errors #681 (spaut33)

3.0 - 2022-06-20

Changed - Update py-moneyed to 2.0. #638 (antonagestam, flaeppe, paoloxnet) - Remove the deprecated Money.decimal_places_display property and argument. #638 (antonagestam, flaeppe, paoloxnet) - Remove the deprecated CURRENCY_DECIMAL_PLACES_DISPLAY setting. #638 (antonagestam, flaeppe, paoloxnet) - Null constraint on an implicit CurrencyField is now declared from null=... argument to MoneyField. #638 (antonagestam, flaeppe, paoloxnet)

Fixed

  • Improve the internal check for whether a currency is provided #657 (davidszotten)

  • Fix test suite for django main branch #657 (davidszotten)

  • MoneyField raises TypeError when default contains a valid amount but no currence, i.e. Money(123, None). #661 (flaeppe)

  • MoneyField supports default of type bytes #661 (flaeppe)

Added

  • Add support for Django 4.0 and 4.1.

  • Add support for Python 3.10.

Removed

  • Drop support for Django 3.1.

  • Drop support for Python 3.6.

2.1.1 - 2022-01-02

Changed

Fixed

  • Make Django REST Framework integration always raise lower-level errors as ValidationError. #601, #637 (flaeppe)

  • False positives in Migration changes, improvements to MoneyField.deconstruct. #646, #648 (flaeppe)

2.1 - 2021-09-17

Added

Removed

2.0.3 - 2021-09-04

Fixed

  • Inconsistent Money._copy_attributes behaviour when non-Money instances are involved. #630 (tned73)

2.0.2 - 2021-09-04

Fixed

  • Inconsistent Money._copy_attributes behaviour. #629 (tned73)

2.0.1 - 2021-07-09

Fixed

  • Invalid deprecation warning behavior. #624 (nerdoc)

2.0 - 2021-05-23

Added

  • New setting CURRENCY_CODE_MAX_LENGTH configures default max_length for MoneyField and exchange app models.

Changed

  • BREAKING: Update py-moneyed to >=1.2,<2. It uses babel to format Money, which formats it differently than py-moneyed<1. #567 (antonagestam)

Deprecated

  • Money.decimal_places_display will be removed in django-money 3.0.

  • CURRENCY_DECIMAL_PLACES_DISPLAY will be removed in django-money 3.0.

1.3.1 - 2021-02-04

Fixed

  • Do not mutate the input moneyed.Money class to djmoney.money.Money in MoneyField.default and F-expressions. #603 (moser)

1.3 - 2021-01-10

Added

  • Improved localization: New setting CURRENCY_DECIMAL_PLACES_DISPLAY configures decimal places to display for each configured currency. #521 (wearebasti)

Changed

  • Set the default value for models.fields.MoneyField to NOT_PROVIDED. (tned73)

Fixed

  • Pin pymoneyed<1.0 as it changed the repr output of the Money class. (Stranger6667)

  • Subtracting Money from moneyed.Money. Regression, introduced in 1.2. #593 (Stranger6667)

  • Missing the right Money.decimal_places and Money.decimal_places_display values after some arithmetic operations. #595 (Stranger6667)

1.2.2 - 2020-12-29

Fixed

  • Confusing “number-over-money” division behavior by backporting changes from py-moneyed. #586 (wearebasti)

  • AttributeError when a Money instance is divided by Money. #585 (niklasb)

1.2.1 - 2020-11-29

Fixed

  • Aggregation through a proxy model. #583 (tned73)

1.2 - 2020-11-26

Fixed

  • Resulting Money object from arithmetics (add / sub / …) inherits maximum decimal_places from arguments #522 (wearebasti)

  • DeprecationWarning related to the usage of cafile in urlopen. #553 (Stranger6667)

Added

  • Django 3.1 support

1.1 - 2020-04-06

Fixed

  • Optimize money operations on MoneyField instances with the same currencies. #541 (horpto)

Added

  • Support for Money type in QuerySet.bulk_update() #534 (satels)

1.0 - 2019-11-08

Added

  • Support for money descriptor customization. (Stranger6667)

  • Fix order_by() not returning money-compatible queryset #519 (lieryan)

  • Django 3.0 support

Removed

Fixed

  • Support instances with decimal_places=0 #509 (fara)

0.15.1 - 2019-06-22

Fixed

  • Respect field decimal_places when instantiating Money object from field db values. #501 (astutejoe)

  • Restored linting in CI tests (benjaoming)

0.15 - 2019-05-30

Warning

This release contains backwards incompatibility, please read the release notes below.

Backwards incompatible changes

  • Remove implicit default value on non-nullable MoneyFields. Backwards incompatible change: set explicit default=0.0 to keep previous behavior. #411 (washeck)

  • Remove support for calling float on Money instances. Use the amount attribute instead. (Stranger6667)

  • MinMoneyValidator and MaxMoneyValidator are not inherited from Django’s MinValueValidator and MaxValueValidator anymore. #376

  • In model and non-model forms forms.MoneyField uses CURRENCY_DECIMAL_PLACES as the default value for decimal_places. #434 (Stranger6667, andytwoods)

Added

  • Add Money.decimal_places for per-instance configuration of decimal places in the string representation.

  • Support for customization of CurrencyField length. Some cryptocurrencies could have codes longer than three characters. #480 (Stranger6667, MrFus10n)

  • Add default_currency option for REST Framework field. #475 (butorov)

Fixed

  • Failing certificates checks when accessing 3rd party exchange rates backends. Fixed by adding certifi to the dependencies list. #403 (Stranger6667)

  • Fixed model-level validators behavior in REST Framework. #376 (rapIsKal, Stranger6667)

  • Setting keyword argument default_currency=None for MoneyField did not revert to settings.DEFAULT_CURRENCY and set str(None) as database value for currency. #490 (benjaoming)

Changed

  • Allow using patched django.core.serializers.python._get_model in serializers, which could be helpful for migrations. (Formulka, Stranger6667)

0.14.4 - 2019-01-07

Changed

  • Re-raise arbitrary exceptions in JSON deserializer as DeserializationError. (Stranger6667)

Fixed

  • Invalid Django 1.8 version check in djmoney.models.fields.MoneyField.value_to_string. (Stranger6667)

  • InvalidOperation in djmoney.contrib.django_rest_framework.fields.MoneyField.get_value when amount is None and currency is not None. #458 (carvincarl)

0.14.3 - 2018-08-14

Fixed

  • djmoney.forms.widgets.MoneyWidget decompression on Django 2.1+. #443 (Stranger6667)

0.14.2 - 2018-07-23

Fixed

0.14.1 - 2018-07-17

Added

  • Support for indirect rates conversion through maximum 1 extra step (when there is no direct conversion rate: converting by means of a third currency for which both source and target currency have conversion rates). #425 (Stranger6667, 77cc33)

Fixed

  • Error was raised when trying to do a query with a ModelWithNullableCurrency. #427 (Woile)

0.14 - 2018-06-09

Added

Fixed

  • Same currency conversion getting MissingRate exception #418 (humrochagf)

  • TypeError during templatetag usage inside a for loop on Django 2.0. #402 (f213)

Removed

  • Support for Python 3.3 #410 (benjaoming)

  • Deprecated choices argument from djmoney.forms.fields.MoneyField. Use currency_choices instead. (Stranger6667)

0.13.5 - 2018-05-19

Fixed

0.13.4 - 2018-05-19

Fixed

0.13.3 - 2018-05-12

Added

  • Rounding support via round built-in function on Python 3. (Stranger6667)

0.13.2 - 2018-04-16

Added

Fixed

  • Exchange rates. TypeError when decoding JSON on Python 3.3-3.5. #399 (kcyeu)

  • Managers patching for models with custom Meta.default_manager_name. #400 (Stranger6667)

0.13.1 - 2018-04-07

Fixed

0.13 - 2018-04-07

Added

Removed

  • Support for django-money-rates #385 (Stranger6667)

  • Deprecated Money.__float__ which is implicitly called on some sum() operations #347. (jonashaag)

Migration from django-money-rates

The new application is a drop-in replacement for django-money-rates. To migrate from django-money-rates:

  • In INSTALLED_APPS replace djmoney_rates with djmoney.contrib.exchange

  • Set OPEN_EXCHANGE_RATES_APP_ID setting with your app id

  • Run python manage.py migrate

  • Run python manage.py update_rates

For more information, look at Working with Exchange Rates section in README.

0.12.3 - 2017-12-13

Fixed

  • Fixed BaseMoneyValidator with falsy limit values. #371 (1337)

0.12.2 - 2017-12-12

Fixed

Changed

0.12.1 - 2017-11-20

Fixed

0.12 - 2017-10-22

Added

Changed

  • Improved Money support. Now django-money fully relies on pymoneyed localization everywhere, including Django admin. #276 (Stranger6667)

  • Implement __html__ method. If used in Django templates, an Money object’s amount and currency are now separated with non-breaking space (&nbsp;) #337 (jonashaag)

Deprecated

  • djmoney.models.fields.MoneyPatched and moneyed.Money are deprecated. Use djmoney.money.Money instead.

Fixed

Removed

  • Dropped support for Python 2.6 and 3.2. (Stranger6667)

  • Dropped support for Django 1.4, 1.5, 1.6, 1.7 and 1.9. (Stranger6667)

0.11.4 - 2017-06-26

Fixed

0.11.3 - 2017-06-19

Fixed

  • Restored support for Django 1.4, 1.5, 1.6, and 1.7 & Python 2.6 #304 (Stranger6667)

0.11.2 - 2017-05-31

Fixed

0.11.1 - 2017-05-26

Fixed

Removed

0.11 - 2017-05-19

Added

Fixed

0.10.2 - 2017-02-18

Added

Fixed

0.10.1 - 2016-12-26

Fixed

  • Fixed default value for djmoney.forms.fields.MoneyField. #249 (tsouvarev)

0.10 - 2016-12-19

Changed

Fixed

0.9.1 - 2016-08-01

Fixed

  • Fixed packaging.

0.9.0 - 2016-07-31

NB! If you are using custom model managers not named objects and you expect them to still work, please read below.

Added

Changed

  • Changed auto conversion of currencies using djmoney_rates (added in 0.7.3) to be off by default. You must now add AUTO_CONVERT_MONEY = True in your settings.py if you want this feature. #199 (spookylukey)

  • Only make objects a MoneyManager instance automatically. #194 and #201 (inureyes)

Fixed

Note about automatic model manager patches

In 0.8, Django-money automatically patches every model managers with MoneyManager. This causes migration problems if two or more managers are used in the same model.

As a side effect, other managers are also finally wrapped with MoneyManager. This effect leads Django migration to point to fields with other managers to MoneyManager, and raises ValueError (MoneyManager only exists as a return of money_manager, not a class-form. However migration procedure tries to find MoneyManager to patch other managers.)

From 0.9, Django-money only patches objects with MoneyManager by default (as documented). To patch other managers (e.g. custom managers), patch them by wrapping with money_manager.

from djmoney.models.managers import money_manager


class BankAccount(models.Model):
    balance = MoneyField(max_digits=10, decimal_places=2, default_currency='USD')
    accounts = money_manager(MyCustomManager())

0.8 - 2016-04-23

Added

Changed

Fixed

0.7.6 - 2016-01-08

Added

  • Added correct paths for py.test discovery. (benjaoming)

  • Mention Django 1.9 in tox.ini. (benjaoming)

Fixed

  • Fix for get_or_create / create manager methods not respecting currency code. (toudi)

  • Fix unit tests. (toudi)

  • Fix for using MoneyField with F expressions when using Django >= 1.8. (toudi)

0.7.5 - 2015-12-22

Fixed

  • Fallback to _meta.fields if _meta.get_fields raises AttributeError #149 (browniebroke)

  • pip instructions updated. (GheloAce)

0.7.4 - 2015-11-02

Added

Fixed

0.7.3 - 2015-10-16

Added

Fixed

  • Fix using Choices for setting currency choices. (benjaoming)

  • Fix tests for Python 2.6. (plumdog)

0.7.2 - 2015-09-01

Fixed

  • Better checks on None values. (tsouvarev, sjdines)

  • Consistency with South declarations and calling str function. (sjdines)

0.7.1 - 2015-08-11

Fixed

  • Fix bug in printing MoneyField. (YAmikep)

  • Added fallback value for current locale getter. (sjdines)

0.7.0 - 2015-06-14

Added

  • Django 1.8 compatibility. (willhcr)

0.6.0 - 2015-05-23

Added

  • Python 3 trove classifier. (dekkers)

Changed

Fixed

0.5.0 - 2014-12-15

Added

  • Django 1.7 compatibility. (w00kie)

Fixed

  • Added choices= to instantiation of currency widget. (davidstockwell)

  • Nullable MoneyField should act as default=None. (jakewins)

  • Fixed bug where a non-required MoneyField threw an exception. (spookylukey)

0.4.2 - 2014-07-31

0.4.1 - 2013-11-28

0.4.0.0 - 2013-11-26

Added

  • Python 3 compatibility.

  • tox tests.

  • Format localization.

  • Template tag money_localize.

0.3.4 - 2013-11-25

0.3.3.2 - 2013-10-31

0.3.3.1 - 2013-10-01

0.3.3 - 2013-02-17

Added

  • South support via implementing the south_triple_field method. (mattions)

Fixed

  • Fixed issues with money widget not passing attrs up to django’s render method, caused id attribute to not be set in html for widgets. (adambregenzer)

  • Fixed issue of default currency not being passed on to widget. (snbuchholz)

  • Return the right default for South. (mattions)

  • Django 1.5 compatibility. (devlocal)

0.3.2 - 2012-11-30

Fixed

  • Fixed issues with display_for_field not detecting fields correctly. (adambregenzer)

  • Added South ignore rule to avoid duplicate currency field when using the frozen ORM. (rach)

  • Disallow override of objects manager if not setting it up with an instance. (rach)

0.3.1 - 2012-10-11

Fixed

  • Fix AttributeError when Model inherit a manager. (rach)

  • Correctly serialize the field. (akumria)

0.3 - 2012-09-30

Added

  • Allow django-money to be specified as read-only in a model. (akumria)

  • South support: Declare default attribute values. (pjdelport)

0.2 - 2012-04-10

  • Initial public release