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(

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.

Files for rest-framework-money-field, version 1.2.0
Filename, size File type Python version Upload date Hashes
Filename, size rest_framework_money_field-1.2.0-py3-none-any.whl (3.3 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size rest-framework-money-field-1.2.0.tar.gz (3.2 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page