Changelog¶
Unreleased - TBD¶
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
toNOT_PROVIDED
. (tned73)
Fixed
- Pin
pymoneyed<1.0
as it changed therepr
output of theMoney
class. (Stranger6667) - Subtracting
Money
frommoneyed.Money
. Regression, introduced in1.2
. #593 (Stranger6667) - Missing the right
Money.decimal_places
andMoney.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 aMoney
instance is divided byMoney
. #585 (niklasb)
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 ofcafile
inurlopen
. #553 (Stranger6667)
Added
- Django 3.1 support
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
- Support for Django 1.8 & 2.0. (Stranger6667)
- Support for Python 2.7. #515 (benjaoming)
- Support for Python 3.4. (Stranger6667)
MoneyPatched
, usedjmoney.money.Money
instead. (Stranger6667)
Fixed
0.15.1 - 2019-06-22¶
Fixed
- Respect field
decimal_places
when instantiatingMoney
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
onMoney
instances. Use theamount
attribute instead. (Stranger6667) MinMoneyValidator
andMaxMoneyValidator
are not inherited from Django’sMinValueValidator
andMaxValueValidator
anymore. #376- In model and non-model forms
forms.MoneyField
usesCURRENCY_DECIMAL_PLACES
as the default value fordecimal_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
forMoneyField
did not revert tosettings.DEFAULT_CURRENCY
and setstr(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
- Validation of
djmoney.forms.fields.MoneyField
whendisabled=True
is passed to it. #439 (stinovlas, Stranger6667)
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
0.14 - 2018-06-09¶
Added
- Caching of exchange rates. #398 (Stranger6667)
- Added support for nullable
CurrencyField
. #260 (Stranger6667)
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 fromdjmoney.forms.fields.MoneyField
. Usecurrency_choices
instead. (Stranger6667)
0.13.4 - 2018-05-19¶
Fixed
- Packaging of
djmoney.contrib.exchange.management.commands
. #412 (77cc33, Stranger6667)
0.13.2 - 2018-04-16¶
Added
- Django Admin integration for exchange rates. #392 (Stranger6667)
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
- Regression: Could not run w/o
django.contrib.exchange
#388 (Stranger6667)
0.13 - 2018-04-07¶
Added
- Currency exchange #385 (Stranger6667)
Removed
- Support for
django-money-rates
#385 (Stranger6667) - Deprecated
Money.__float__
which is implicitly called on somesum()
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
replacedjmoney_rates
withdjmoney.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.2 - 2017-12-12¶
Fixed
- Django master branch compatibility. #361 (Stranger6667)
- Fixed
get_or_create
for models with shared currency. #364 (Stranger6667)
Changed
- Removed confusing rounding to integral value in
Money.__repr__
. #366 (Stranger6667, evenicoulddoit)
0.12.1 - 2017-11-20¶
Fixed
- Fixed migrations on SQLite. #139, #338 (Stranger6667)
- Fixed
Field.rel.to
usage for Django 2.0. #349 (richardowen) - Fixed Django REST Framework behaviour for serializers without
*_currency
field in serializer’sMeta.fields
. #351 (elcolie, Stranger6667)
0.12 - 2017-10-22¶
Added
- Ability to specify name for currency field. #195 (Stranger6667)
- Validators for
MoneyField
. #308 (Stranger6667)
Changed
- Improved
Money
support. Nowdjango-money
fully relies onpymoneyed
localization everywhere, including Django admin. #276 (Stranger6667) - Implement
__html__
method. If used in Django templates, anMoney
object’s amount and currency are now separated with non-breaking space (
) #337 (jonashaag)
Deprecated
djmoney.models.fields.MoneyPatched
andmoneyed.Money
are deprecated. Usedjmoney.money.Money
instead.
Fixed
- Fixed model field validation. #308 (Stranger6667).
- Fixed managers caching for Django >= 1.10. #318 (Stranger6667).
- Fixed
F
expressions support forin
lookups. #321 (Stranger6667). - Fixed money comprehension on querysets. #331 (Stranger6667, jaavii1988).
- Fixed errors in Django Admin integration. #334 (Stranger6667, adi-).
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.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.1 - 2017-05-26¶
Fixed
- Fixed access to models properties. #297 (mithrilstar, Stranger6667)
Removed
- Dropped support for Python 2.6. (Stranger6667)
- Dropped support for Django < 1.8. (Stranger6667)
0.11 - 2017-05-19¶
Added
- An ability to set custom currency choices via
CURRENCY_CHOICES
settings option. #211 (Stranger6667, ChessSpider)
Fixed
- Fixed
AttributeError
inget_or_create
when the model have no default. #268 (Stranger6667, lobziik) - Fixed
UnicodeEncodeError
in string representation ofMoneyPatched
on Python 2. #272 (Stranger6667) - Fixed various displaying errors in Django Admin . #232, #220, #196, #102, #90 (Stranger6667, arthurk, mstarostik, eriktelepovsky, jplehmann, graik, benjaoming, k8n, yellow-sky)
- Fixed non-Money values support for
in
lookup. #278 (Stranger6667) - Fixed available lookups with removing of needless lookup check. #277 (Stranger6667)
- Fixed compatibility with
py-moneyed
. (Stranger6667) - Fixed ignored currency value in Django REST Framework integration. #292 (gonzalobf)
0.10.2 - 2017-02-18¶
Added
- Added ability to configure decimal places output. #154, #251 (ivanchenkodmitry)
Fixed
- Fixed handling of
defaults
keyword argument inget_or_create
method. #257 (kjagiello) - Fixed handling of currency fields lookups in
get_or_create
method. #258 (Stranger6667) - Fixed
PendingDeprecationWarning
during form initialization. #262 (Stranger6667, spookylukey) - Fixed handling of
F
expressions which involve non-Money fields. #265 (Stranger6667)
0.10 - 2016-12-19¶
Changed
- Do not fail comparisons because of different currency. Just return
False
#225 (benjaoming and ivirabyan)
Fixed
- Fixed
understands_money
behaviour. Now it can be used as a decorator #215 (Stranger6667) - Fixed: Not possible to revert MoneyField currency back to default #221 (benjaoming)
- Fixed invalid
creation_counter
handling. #235 (msgre and Stranger6667) - Fixed broken field resolving. #241 (Stranger6667)
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
- Support for
Value
andFunc
expressions in queries. (Stranger6667) - Support for
in
lookup. (Stranger6667) - Django REST Framework support. #179 (Stranger6667)
- Django 1.10 support. #198 (Stranger6667)
- Improved South support. (Stranger6667)
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 yoursettings.py
if you want this feature. #199 (spookylukey) - Only make
objects
a MoneyManager instance automatically. #194 and #201 (inureyes)
Fixed
- Fixed default currency value for nullable fields in forms. #138 (Stranger6667)
- Fixed
_has_changed
deprecation warnings. #206 (Stranger6667) - Fixed
get_or_create
crash, whendefaults
is passed. #213 (Stranger6667, spookylukey)
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
- Support for serialization of
MoneyPatched
instances in migrations. (AlexRiina) - Improved django-money-rates support. #173 (Stranger6667)
- Extended
F
expressions support. (Stranger6667) - Pre-commit hooks support. (benjaoming)
- Isort integration. (Stranger6667)
- Makefile for common commands. (Stranger6667)
- Codecov.io integration. (Stranger6667)
- Python 3.5 builds to tox.ini and travis.yml. (Stranger6667)
- Django master support. (Stranger6667)
- Python 3.2 compatibility. (Stranger6667)
Changed
- Refactored test suite (Stranger6667)
Fixed
- Fixed fields caching. #186 (Stranger6667)
- Fixed m2m fields data loss on Django < 1.8. #184 (Stranger6667)
- Fixed managers access via instances. #86 (Stranger6667)
- Fixed currency handling behaviour. #172 (Stranger6667)
- Many PEP8 & flake8 fixes. (benjaoming)
- Fixed filtration with
F
expressions. #174 (Stranger6667) - Fixed querying on Django 1.8+. #166 (Stranger6667)
0.7.6 - 2016-01-08¶
Added
- Added correct paths for py.test discovery. (benjaoming)
- Mention Django 1.9 in tox.ini. (benjaoming)
Fixed
0.7.5 - 2015-12-22¶
Fixed
- Fallback to
_meta.fields
if_meta.get_fields
raisesAttributeError
#149 (browniebroke) - pip instructions updated. (GheloAce)
0.7.3 - 2015-10-16¶
Added
- Sum different currencies. (dnmellen)
__eq__
method. (benjaoming)- Comparison of different currencies. (benjaoming)
- Default currency. (benjaoming)
Fixed
- Fix using Choices for setting currency choices. (benjaoming)
- Fix tests for Python 2.6. (plumdog)
0.6.0 - 2015-05-23¶
Added
- Python 3 trove classifier. (dekkers)
Changed
- Tox cleanup. (edwinlunando)
- Improved
README
. (glarrain) - Added/Cleaned up tests. (spookylukey, AlexRiina)
Fixed
- Append
_currency
to non-money ExpressionFields. #101 (alexhayes, AlexRiina, briankung) - Data truncated for column. #103 (alexhayes)
- Fixed
has_changed
not working. #95 (spookylukey) - Fixed proxy model with
MoneyField
returns wrong class. #80 (spookylukey)
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 asdefault=None
. (jakewins) - Fixed bug where a non-required
MoneyField
threw an exception. (spookylukey)
0.4.0.0 - 2013-11-26¶
Added
- Python 3 compatibility.
- tox tests.
- Format localization.
- Template tag
money_localize
.
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)