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.0.0.tar.gz (27.1 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.0.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: rest_framework_money_field-3.0.0.tar.gz
  • Upload date:
  • Size: 27.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.1 {"installer":{"name":"uv","version":"0.10.1","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.0.0.tar.gz
Algorithm Hash digest
SHA256 843dc710f9c99580af2dcb4ad4535f1975876883d5dee0be0b2a890067fc9130
MD5 22e7b82666008067043926f4b84b4bf5
BLAKE2b-256 8699c8a45840b548673d7fe2d77a78bd10753c814bc1d131198718ddb51bb8a8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: rest_framework_money_field-3.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.1 {"installer":{"name":"uv","version":"0.10.1","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.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5a95fa23b818ff692e3a8879a0b1d300b5ed1af7dbc42dc03a9a0aecfee06549
MD5 94cef12076a861b5a3065dd19ab679ba
BLAKE2b-256 730eda8bdeacaff010dc77bf4f5c92cb8f21684fb18d2e42feeb013a866dc6e2

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