Skip to content

Commit

Permalink
chore: don't register json serializer by default (#729)
Browse files Browse the repository at this point in the history
* chore: don't register json serializer by default

Related to this issue #636, registering the serializer within `djmoney` package will override any customised json serializer provided by the user.
The user should have the control of using the serializer provided by `djmoney` with Django `SERIALIZATION_MODULES` setting.

* Add documentation & minor version bump

* remove version update

* update changes
  • Loading branch information
fhavret committed Sep 30, 2023
1 parent 08e722a commit 9e3442a
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
11 changes: 11 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,17 @@ need to manually decorate those custom methods, like so:
def my_custom_method(*args, **kwargs):
# Awesome stuff
Note on serialization
---------------------

Django-money provides a custom deserializer, it is not registered
by default so you will have to actively register it in your ``settings.py``.

.. code:: python
SERIALIZATION_MODULES = {"json": "djmoney.serializers"}
Format localization
-------------------

Expand Down
4 changes: 0 additions & 4 deletions djmoney/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +0,0 @@
from django.core import serializers


serializers.register_serializer("json", "djmoney.serializers")
2 changes: 1 addition & 1 deletion docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Changelog

**Changed**

- (add entry here)
- 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

0 comments on commit 9e3442a

Please sign in to comment.