Skip to content

Commit

Permalink
Updated CURRENCY_CHOICES to exclude currency "XXX" instead of DEFAULT…
Browse files Browse the repository at this point in the history
…_CURRENCY (#740)

* Updated CURRENCY_CHOICES to exclude currency "XXX" instead of DEFAULT_CURRENCY

* Add release notes for #740, fixup mistakes in release notes

---------

Co-authored-by: Benjamin Bach <benjamin@overtag.dk>
  • Loading branch information
Naggafin and benjaoming committed Nov 27, 2023
1 parent 370c948 commit 2f7ea10
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
6 changes: 4 additions & 2 deletions djmoney/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

from django.conf import settings

from moneyed import CURRENCIES, Currency
from moneyed import CURRENCIES, XXX, Currency


# The default currency, you can define this in your project's settings module
Expand All @@ -21,7 +21,9 @@
if PROJECT_CURRENCIES:
CURRENCY_CHOICES = [(code, CURRENCIES[code].name) for code in PROJECT_CURRENCIES]
else:
CURRENCY_CHOICES = [(c.code, c.name) for i, c in CURRENCIES.items() if c != DEFAULT_CURRENCY]
# 'XXX' is a backport from py-moneyed for transactions involving no currency;
# this was previously referred to as moneyed.classes.DEFAULT_CURRENCY_CODE
CURRENCY_CHOICES = [(c.code, c.name) for i, c in CURRENCIES.items() if c != XXX]

CURRENCY_CHOICES.sort(key=operator.itemgetter(1, 0))
DECIMAL_PLACES = getattr(settings, "CURRENCY_DECIMAL_PLACES", 2)
Expand Down
16 changes: 6 additions & 10 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,9 @@ Changelog
`Unreleased`_ (TBA)
-------------------

**Added**

- (add entry here)

**Fixed**

- (add entry here)

**Changed**

- (add entry here)
- The default setting for ``CURRENCY_CHOICES`` excluded the currency choice defined by ``DEFAULT_CURRENCY``. `#739`_ (`Naggafin`_)


`3.4`_ - 2023-10-17
Expand All @@ -29,7 +21,7 @@ Changelog

**Changed**

- Don't register Django Money serializers by default, instead the user should actively register a serializer in the ``settings.py`` `#636` (`emorozov`)
- 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
Expand Down Expand Up @@ -873,6 +865,7 @@ wrapping with ``money_manager``.
.. _0.3: https://github.com/django-money/django-money/compare/0.2...0.3
.. _0.2: https://github.com/django-money/django-money/compare/0.2...a6d90348085332a393abb40b86b5dd9505489b04

.. _#739: https://github.com/django-money/django-money/pull/739
.. _#700: https://github.com/django-money/django-money/pull/700
.. _#692: https://github.com/django-money/django-money/pull/692
.. _#689: https://github.com/django-money/django-money/pull/689
Expand All @@ -885,6 +878,7 @@ wrapping with ``money_manager``.
.. _#646: https://github.com/django-money/django-money/issues/646
.. _#638: https://github.com/django-money/django-money/issues/638
.. _#637: https://github.com/django-money/django-money/issues/637
.. _#636: https://github.com/django-money/django-money/issues/736
.. _#630: https://github.com/django-money/django-money/pull/630
.. _#629: https://github.com/django-money/django-money/pull/629
.. _#624: https://github.com/django-money/django-money/issues/624
Expand Down Expand Up @@ -1022,6 +1016,7 @@ wrapping with ``money_manager``.
.. _dnmellen: https://github.com/dnmellen
.. _edwinlunando: https://github.com/edwinlunando
.. _elcolie: https://github.com/elcolie
.. _emorozov: https://github.com/emorozov
.. _eriktelepovsky: https://github.com/eriktelepovsky
.. _evenicoulddoit: https://github.com/evenicoulddoit
.. _f213: https://github.com/f213
Expand Down Expand Up @@ -1052,6 +1047,7 @@ wrapping with ``money_manager``.
.. _MrFus10n: https://github.com/MrFus10n
.. _msgre: https://github.com/msgre
.. _mstarostik: https://github.com/mstarostik
.. _Naggafin: https://github.com/Naggafin
.. _niklasb: https://github.com/niklasb
.. _nerdoc: https://github.com/nerdoc
.. _nschlemm: https://github.com/nschlemm
Expand Down

0 comments on commit 2f7ea10

Please sign in to comment.