From 75ed5900321d170debef4ac452b8b3cf8a1c2384 Mon Sep 17 00:00:00 2001 From: Iulia Chiriac Date: Tue, 14 Apr 2015 18:11:12 -0400 Subject: Fixed #24636 -- Added model field validation for decimal places and max digits. --- docs/ref/validators.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'docs/ref') diff --git a/docs/ref/validators.txt b/docs/ref/validators.txt index 6f10b44284..9bbcf9bcbc 100644 --- a/docs/ref/validators.txt +++ b/docs/ref/validators.txt @@ -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``. -- cgit v1.3