mirror of
https://github.com/django/django.git
synced 2025-07-24 13:44:32 +00:00
Fixed #24636 -- Added model field validation for decimal places and max digits.
This commit is contained in:
parent
6f1b09bb5c
commit
75ed590032
6 changed files with 134 additions and 49 deletions
|
@ -281,3 +281,19 @@ to, or in lieu of custom ``field.clean()`` methods.
|
|||
.. versionchanged:: 1.8
|
||||
|
||||
The ``message`` parameter was added.
|
||||
|
||||
``DecimalValidator``
|
||||
--------------------
|
||||
|
||||
.. class:: DecimalValidator(max_digits, decimal_places)
|
||||
|
||||
.. versionadded:: 1.9
|
||||
|
||||
Raises :exc:`~django.core.exceptions.ValidationError` with the following
|
||||
codes:
|
||||
|
||||
- ``'max_digits'`` if the number of digits is larger than ``max_digits``.
|
||||
- ``'max_decimal_places'`` if the number of decimals is larger than
|
||||
``decimal_places``.
|
||||
- ``'max_whole_digits'`` if the number of whole digits is larger than
|
||||
the difference between ``max_digits`` and ``decimal_places``.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue