summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2025-11-17 13:43:47 +0100
committerGitHub <noreply@github.com>2025-11-17 13:43:47 +0100
commit1ce6e78dd4beed702f15fa0be798dd17a15d4ba8 (patch)
tree0078da5312fb69897bb6327040d51c3450d2fa3b /docs
parent5c60763561c67924eff1069e1516b60a59d068d5 (diff)
Fixed #24920 -- Added support for DecimalField with no precision.
Thanks Lily for the review.
Diffstat (limited to 'docs')
-rw-r--r--docs/ref/checks.txt2
-rw-r--r--docs/ref/models/fields.txt17
-rw-r--r--docs/releases/6.1.txt5
3 files changed, 21 insertions, 3 deletions
diff --git a/docs/ref/checks.txt b/docs/ref/checks.txt
index c297938f45..1a79023b89 100644
--- a/docs/ref/checks.txt
+++ b/docs/ref/checks.txt
@@ -196,6 +196,8 @@ Model fields
* **fields.E133**: ``max_digits`` must be a positive integer.
* **fields.E134**: ``max_digits`` must be greater or equal to
``decimal_places``.
+* **fields.E135**: ``DecimalField``’s ``max_digits`` and ``decimal_places``
+ must both be defined or both omitted.
* **fields.E140**: ``FilePathField``\s must have either ``allow_files`` or
``allow_folders`` set to True.
* **fields.E150**: ``GenericIPAddressField``\s cannot have ``blank=True`` if
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index 649073b708..9aacbd2922 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -862,16 +862,22 @@ A fixed-precision decimal number, represented in Python by a
:class:`~decimal.Decimal` instance. It validates the input using
:class:`~django.core.validators.DecimalValidator`.
-Has the following **required** arguments:
+Has the following arguments:
.. attribute:: DecimalField.max_digits
The maximum number of digits allowed in the number. Note that this number
- must be greater than or equal to ``decimal_places``.
+ must be greater than or equal to ``decimal_places``. It's always required
+ on MySQL because this database doesn't support numeric fields with no
+ precision. It's also required for all database backends when
+ :attr:`~DecimalField.decimal_places` is provided.
.. attribute:: DecimalField.decimal_places
- The number of decimal places to store with the number.
+ The number of decimal places to store with the number. It's always required
+ on MySQL because this database doesn't support numeric fields with no
+ precision. It's also required for all database backends when
+ :attr:`~DecimalField.max_digits` is provided.
For example, to store numbers up to ``999.99`` with a resolution of 2 decimal
places, you'd use::
@@ -895,6 +901,11 @@ when :attr:`~django.forms.Field.localize` is ``False`` or
should also be aware of :ref:`SQLite limitations <sqlite-decimal-handling>`
of decimal fields.
+.. versionchanged:: 6.1
+
+ Support for ``DecimalField`` with no precision was added on Oracle,
+ PostgreSQL, and SQLite.
+
``DurationField``
-----------------
diff --git a/docs/releases/6.1.txt b/docs/releases/6.1.txt
index 8c5594d5b6..425419529b 100644
--- a/docs/releases/6.1.txt
+++ b/docs/releases/6.1.txt
@@ -247,6 +247,11 @@ Models
top-level or nested JSON ``null`` values. See
:ref:`storing-and-querying-for-none` for usage examples and some caveats.
+* :attr:`DecimalField.max_digits <django.db.models.DecimalField.max_digits>`
+ and :attr:`DecimalField.decimal_places
+ <django.db.models.DecimalField.decimal_places>` are no longer required to be
+ set on Oracle, PostgreSQL, and SQLite.
+
Pagination
~~~~~~~~~~