Text and numeric field types
corebeginnerCharField requires max_length (a bounded string); TextField has none (unbounded). Integer/BigInteger/PositiveInteger differ only in range. DecimalField (max_digits + decimal_places, fixed precision) is for money; FloatField (native float, imprecise) is not.
Think of it as
DecimalField vs FloatField is the one distinction worth internalizing here: DecimalField stores an exact base-10 number (Python's Decimal), FloatField stores an approximate binary one (Python's float) — 0.1 + 0.2 genuinely does not equal 0.3 in binary floating point, a rounding error that compounds across thousands of transactions if used for money. Everything else in this group is a straightforward choice of range (Integer vs BigInteger) or shape (bounded vs unbounded text).
What we're doing: See the real precision difference between DecimalField and FloatField for a value that exposes binary floating-point error.
- 4
- Binary floating point cannot represent 0.1 or 0.2 exactly — the tiny error is invisible in a single value but compounds across many additions, which is exactly what a running account balance or an invoice total does.
- 7
- Decimal built from strings (not floats) represents the value exactly in base 10 — the same representation DecimalField stores in the database.
Why this works: This is not a Django-specific quirk — it is how IEEE 754 binary floating point works in every language that uses it. DecimalField exists specifically so a model field storing money never inherits this class of rounding error, by using a different underlying representation (base-10, arbitrary precision) instead of trying to work around float's limitations after the fact.
Using FloatField for a price or any other monetary value
Wrong
Better
What you see: A sum of line-item totals doesn't exactly equal the stored order total after enough transactions — off by a cent, in a way that is very hard to reproduce or explain from any single record.
Why: Every FloatField arithmetic operation risks the same binary-representation error as 0.1 + 0.2 — individually negligible, but compounding unpredictably across many additions, subtractions, and stored/reloaded values over an order's lifetime. DecimalField's exact base-10 representation has no such error to accumulate.
- Decimal("0.1") + Decimal("0.2") — Decimal('0.3') — exact
- 0.1 + 0.2 (float) — 0.30000000000000004 — not exact
Text and numeric fields at a glance
Together
Remember: DecimalField (exact, max_digits+decimal_places) for money; FloatField (binary, imprecise) never for money. CharField requires max_length; TextField has none.
See also: models · primary keys and field options · date and time fields

