Skip to main content

A DRF serializer for monetary values.

Project description

Money field for Django REST framework

pipeline status coverage report pypi

An serializer field implementation for Django REST framework that serializes monetary types provided by py-moneyed library. Serialized data is compatible with Dinero.js JavaScript library.

Usage example

For example, if you would have an serializer like this:

from rest_framework.serializers import Serializer
from rest_framework_money_field import MoneyField


class ProductSerializer(Serializer):
    price = MoneyField()

And you would use the serializer with data like this:

from moneyed import Money
from rest_framework.renderers import JSONRenderer

serializer = ProductSerializer({"price": Money(50, "EUR")})
json = JSONRenderer().render(serializer.data)

You would end up with JSON like this:

{
    "price": {
        "amount": 5000,
        "currency": "EUR"
    }
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

rest_framework_money_field-3.1.0.tar.gz (27.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rest_framework_money_field-3.1.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file rest_framework_money_field-3.1.0.tar.gz.

File metadata

  • Download URL: rest_framework_money_field-3.1.0.tar.gz
  • Upload date:
  • Size: 27.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for rest_framework_money_field-3.1.0.tar.gz
Algorithm Hash digest
SHA256 462a2e29dc35a24c5a5764c9773c379a33e022d39ba551712450b6025ac9fecf
MD5 730ee4b994025e156b2fdbddc7d05328
BLAKE2b-256 d784aa2efda82aa9ca9d81ab9f9dad59a682de2fecbf538a7ec64eb3274e126c

See more details on using hashes here.

File details

Details for the file rest_framework_money_field-3.1.0-py3-none-any.whl.

File metadata

  • Download URL: rest_framework_money_field-3.1.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.20 {"installer":{"name":"uv","version":"0.11.20","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux","version":"13","id":"trixie","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for rest_framework_money_field-3.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9dda4c43bdfc5a35df2b6e734a70b2acc566b391cef65deaa188e845668be42c
MD5 794a2ce56c0a3a7eb158c174e66a7102
BLAKE2b-256 cebda537c2fc64728a11a22535e085d236975ea3d4fd575a9938c640188873c1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page