Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
MoneyField
✓ from django_prices.models import MoneyField
Correct import for the Money model field
TaxedMoneyField
✓ from django_prices.models import TaxedMoneyField
Correct import for TaxedMoneyField
satchless.contrib.django_prices.models.MoneyField
✓
✗ from satchless.contrib.django_prices.models import MoneyField
old location from v0.x; no longer available
Define a Django model with MoneyField and TaxedMoneyField, including default values. Ensure Django is configured before importing the model.
import os
os.environ['DJANGO_SETTINGS_MODULE'] = 'tests.settings'
import django
django.setup()
from django.db import models
from django_prices.models import MoneyField, TaxedMoneyField
from prices import Money, TaxedMoney
class Product(models.Model):
name = models.CharField(max_length=100)
price = MoneyField(currency='USD', max_digits=10, decimal_places=2, default=Money('0', 'USD'))
taxed_price = TaxedMoneyField(currency='USD', max_digits=10, decimal_places=2, default=TaxedMoney(Money('0', 'USD'), Money('0', 'USD')))
class Meta:
app_label = 'test_app'
# Creating an instance
product = Product(name='Test', price=Money('10', 'USD'), taxed_price=TaxedMoney(Money('10', 'USD'), Money('1', 'USD')))
product.save()
Errors
Common errors & fixes
ImportError: cannot import name 'MoneyField' from 'django_prices'
Incorrect import path; users often try 'from django_prices import MoneyField' instead of from the models submodule.
fixUse 'from django_prices.models import MoneyField'.
TypeError: 'int' object is not callable
Using a numeric default like default=0 instead of a Money object.
fixSet default=Money('0', 'USD') or default=TaxedMoney(Money('0', 'USD'), Money('0', 'USD')). AttributeError: 'NoneType' object has no attribute 'currency'
The field value is None but the code expects a Money object. Occurs when the field is nullable and not set.
fixEnsure the field is not nullable or provide a default.
Upgrade
Version history
2.4.0latest on PyPI · released Oct 29, 2025
Audit
Dependencies
pricesrequiredcore library providing Money, TaxedMoney, etc.
Djangorequiredframework for model fields and migrations
Babeloptionaloptional for currency formatting