Django Money is a little Django app that integrates the `py-moneyed` library to add robust support for money and currency fields in Django models and forms. It ensures accurate handling of monetary values, currency conversions, and formatting. The current version, 3.6.0, supports modern Django and Python versions and is actively maintained with regular releases.
pip install django-moneyVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to define a `MoneyField` in a Django model, create instances with `Money` objects, and perform basic queries. It also highlights the required `INSTALLED_APPS` entry and the use of localization settings for proper display. The template tag `money_localize` is conceptually shown for front-end rendering.
Review the official changelog and documentation for your specific upgrade path. Replace removed settings and update import paths (e.g., use `djmoney.money.Money` instead of `moneyed.Money`). Ensure your Django and Python versions meet the minimum requirements for `django-money` 3.x (Python >=3.7, Django 2.2, 3.2, 4.0, 4.1, 4.2 supported by 3.6.0).
Update all instances of `from moneyed import Money` to `from djmoney.money import Money`. Remove any usage of `MoneyPatched`.
Perform all monetary operations using `Money` objects, which internally rely on `Decimal`. For direct arithmetic with amounts, ensure you convert to `Decimal` first if not already a `Money` object.
Add `'djmoney'` to `INSTALLED_APPS` and `USE_L10N = True` in your Django `settings.py` file.
Wrap your custom manager: `objects = money_manager(MyCustomManager())`.
Prefer ORM operations with `Money` objects. If direct database column access is needed, use the automatically generated `fieldname_amount` and `fieldname_currency` columns.