Skip to main content

ABOUT

django_price is an attempt to implement price representation in django, the right way. Prices itself are very easy to implement, but may be done very wrong if it comes to do calculations including tax.

django_price features a Price class to represent net/tax/gross prices. This class may be added, multiplied, … like you would some “simple decimal” expect to behave. Internaly however it keeps track of all applied taxes and its corresponsing net/tax/groos amounts. So adding two prices to calculate the total of - for example - an invoice does not loose important information (like which tax amounts are included).

WHY

As said above price calculation can go terribly wrong. This even happens for big players like Magento (10€ product + 5€ shipping = 15.01€ for 19% tax). django_price tries to do things right, to avoid such issues.

FEATURES

  • Basic calculation for prices (including tax information)

  • Knows the used currency (for rounding and formatting)

  • Stores taxes to your database (LinearTax and Multitax)

  • Proper rounding for prices (on demand, based on used currency)

  • Utilities to: - Store prices to the database - Round prices based on the used currency

ROUNDING

django_price does implicid rounding when calculating the net/gross/tax amount of prices. In addition the raw, precise values are stored. So when you calculate with prices this is always done using the precise prices, afterwards the rounded results are recalculated.

If yoou need prices to stay stable (10 times 100 should be exactly 1000) you may need to do explicid rounding.

REQUIREMENTS

  • Django (obviously)

  • django_deferred_polymorph (may be skipped if you don’t use the supplied models)

Metadata

Release files for django_price 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django_price 0.2.1
File Size Uploaded Provenance
django_price-0.2.1.tar.gz 16.2 kB Without provenance Details

Release files / django_price-0.2.1.tar.gz

Download URL django_price-0.2.1.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
270cb8dd05ea7f9635c010135d701b2eaa1a1016fff493e2f0f6ca7d1323702f
BLAKE2b-256 checksum
How to use checksums
addf78e8d6e61871d6b85e500eed80eef9c40011ac3404eb524814c8aca9ac5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for django_price 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page