summaryrefslogtreecommitdiff
path: root/docs/ref/forms/fields.txt
diff options
context:
space:
mode:
authorKapil Bansal <kapilbansal.gbpecdelhi@gmail.com>2022-05-12 11:30:47 +0200
committerCarlton Gibson <carlton@noumenal.es>2022-05-12 14:16:52 +0200
commit3a82b5f655446f0ca89e3b6a92b100aa458f348f (patch)
tree6e600054369b9316865b3b5b3ab1838769a2b54e /docs/ref/forms/fields.txt
parent68da6b389c403cb91650754be0e2287696807333 (diff)
Fixed #32559 -- Added 'step_size’ to numeric form fields.
Co-authored-by: Jacob Rief <jacob.rief@uibk.ac.at>
Diffstat (limited to 'docs/ref/forms/fields.txt')
-rw-r--r--docs/ref/forms/fields.txt61
1 files changed, 46 insertions, 15 deletions
diff --git a/docs/ref/forms/fields.txt b/docs/ref/forms/fields.txt
index fc92f8998f..4d0205b4d3 100644
--- a/docs/ref/forms/fields.txt
+++ b/docs/ref/forms/fields.txt
@@ -492,18 +492,20 @@ For each field, we describe the default widget used if you don't specify
* Normalizes to: A Python ``decimal``.
* Validates that the given value is a decimal. Uses
:class:`~django.core.validators.MaxValueValidator` and
- :class:`~django.core.validators.MinValueValidator` if ``max_value`` and
- ``min_value`` are provided. Leading and trailing whitespace is ignored.
+ :class:`~django.core.validators.MinValueValidator` if ``max_value`` and
+ ``min_value`` are provided. Uses
+ :class:`~django.core.validators.StepValueValidator` if ``step_size`` is
+ provided. Leading and trailing whitespace is ignored.
* Error message keys: ``required``, ``invalid``, ``max_value``,
``min_value``, ``max_digits``, ``max_decimal_places``,
- ``max_whole_digits``
+ ``max_whole_digits``, ``step_size``.
The ``max_value`` and ``min_value`` error messages may contain
``%(limit_value)s``, which will be substituted by the appropriate limit.
Similarly, the ``max_digits``, ``max_decimal_places`` and
``max_whole_digits`` error messages may contain ``%(max)s``.
- Takes four optional arguments:
+ Takes five optional arguments:
.. attribute:: max_value
.. attribute:: min_value
@@ -521,6 +523,14 @@ For each field, we describe the default widget used if you don't specify
The maximum number of decimal places permitted.
+ .. attribute:: step_size
+
+ Limit valid inputs to an integral multiple of ``step_size``.
+
+ .. versionchanged:: 4.1
+
+ The ``step_size`` argument was added.
+
``DurationField``
-----------------
@@ -636,13 +646,25 @@ For each field, we describe the default widget used if you don't specify
* Validates that the given value is a float. Uses
:class:`~django.core.validators.MaxValueValidator` and
:class:`~django.core.validators.MinValueValidator` if ``max_value`` and
- ``min_value`` are provided. Leading and trailing whitespace is allowed,
- as in Python's ``float()`` function.
+ ``min_value`` are provided. Uses
+ :class:`~django.core.validators.StepValueValidator` if ``step_size`` is
+ provided. Leading and trailing whitespace is allowed, as in Python's
+ ``float()`` function.
* Error message keys: ``required``, ``invalid``, ``max_value``,
- ``min_value``
+ ``min_value``, ``step_size``.
+
+ Takes three optional arguments:
+
+ .. attribute:: max_value
+ .. attribute:: min_value
- Takes two optional arguments for validation, ``max_value`` and ``min_value``.
- These control the range of values permitted in the field.
+ These control the range of values permitted in the field.
+
+ .. attribute:: step_size
+
+ .. versionadded:: 4.1
+
+ Limit valid inputs to an integral multiple of ``step_size``.
``GenericIPAddressField``
-------------------------
@@ -755,21 +777,30 @@ For each field, we describe the default widget used if you don't specify
* Validates that the given value is an integer. Uses
:class:`~django.core.validators.MaxValueValidator` and
:class:`~django.core.validators.MinValueValidator` if ``max_value`` and
- ``min_value`` are provided. Leading and trailing whitespace is allowed,
- as in Python's ``int()`` function.
+ ``min_value`` are provided. Uses
+ :class:`~django.core.validators.StepValueValidator` if ``step_size`` is
+ provided. Leading and trailing whitespace is allowed, as in Python's
+ ``int()`` function.
* Error message keys: ``required``, ``invalid``, ``max_value``,
- ``min_value``
+ ``min_value``, ``step_size``
- The ``max_value`` and ``min_value`` error messages may contain
- ``%(limit_value)s``, which will be substituted by the appropriate limit.
+ The ``max_value``, ``min_value`` and ``step_size`` error messages may
+ contain ``%(limit_value)s``, which will be substituted by the appropriate
+ limit.
- Takes two optional arguments for validation:
+ Takes three optional arguments for validation:
.. attribute:: max_value
.. attribute:: min_value
These control the range of values permitted in the field.
+ .. attribute:: step_size
+
+ .. versionadded:: 4.1
+
+ Limit valid inputs to an integral multiple of ``step_size``.
+
``JSONField``
-------------