summaryrefslogtreecommitdiff
path: root/docs/ref/models
diff options
context:
space:
mode:
authorJeff <3820914+jeffyancey@users.noreply.github.com>2018-08-16 17:03:28 -0400
committerTim Graham <timograham@gmail.com>2018-08-16 17:03:28 -0400
commit3fa3de54152a6b7a67de05ff4ff6fb122c9246e2 (patch)
tree9ae60655fabb52d9f11f182008325e3f8ef23160 /docs/ref/models
parentb523d42561c7832e6d5d7a4a2dcb5fb650b24fb5 (diff)
Fixed #29646 -- Doc'd the validators that each model and form field uses.
Diffstat (limited to 'docs/ref/models')
-rw-r--r--docs/ref/models/fields.txt40
1 files changed, 31 insertions, 9 deletions
diff --git a/docs/ref/models/fields.txt b/docs/ref/models/fields.txt
index 94e299846d..4abb4dddaa 100644
--- a/docs/ref/models/fields.txt
+++ b/docs/ref/models/fields.txt
@@ -414,7 +414,7 @@ guaranteed to fit numbers from ``-9223372036854775808`` to
``BinaryField``
---------------
-.. class:: BinaryField(**options)
+.. class:: BinaryField(max_length=None, **options)
A field to store raw binary data. It only supports ``bytes`` assignment. Be
aware that this field has limited functionality. For example, it is not possible
@@ -427,6 +427,14 @@ case it can't be included in a :class:`~django.forms.ModelForm`.
Older versions don't allow setting ``editable`` to ``True``.
+``BinaryField`` has one extra optional argument:
+
+.. attribute:: BinaryField.max_length
+
+ The maximum length (in characters) of the field. The maximum length is
+ enforced in Django's validation using
+ :class:`~django.core.validators.MaxLengthValidator`.
+
.. admonition:: Abusing ``BinaryField``
Although you might think about storing files in the database, consider that
@@ -468,7 +476,8 @@ The default form widget for this field is a :class:`~django.forms.TextInput`.
.. attribute:: CharField.max_length
The maximum length (in characters) of the field. The max_length is enforced
- at the database level and in Django's validation.
+ at the database level and in Django's validation using
+ :class:`~django.core.validators.MaxLengthValidator`.
.. note::
@@ -551,7 +560,10 @@ The default form widget for this field is a single
.. class:: DecimalField(max_digits=None, decimal_places=None, **options)
A fixed-precision decimal number, represented in Python by a
-:class:`~decimal.Decimal` instance. Has two **required** arguments:
+:class:`~decimal.Decimal` instance. It validates the input using
+:class:`~django.core.validators.DecimalValidator`.
+
+Has two **required** arguments:
.. attribute:: DecimalField.max_digits
@@ -603,8 +615,8 @@ SECOND(6)``. Otherwise a ``bigint`` of microseconds is used.
.. class:: EmailField(max_length=254, **options)
-A :class:`CharField` that checks that the value is a valid email address. It
-uses :class:`~django.core.validators.EmailValidator` to validate the input.
+A :class:`CharField` that checks that the value is a valid email address using
+:class:`~django.core.validators.EmailValidator`.
``FileField``
-------------
@@ -969,9 +981,15 @@ The default form widget for this field is a
.. class:: IntegerField(**options)
An integer. Values from ``-2147483648`` to ``2147483647`` are safe in all
-databases supported by Django. The default form widget for this field is a
-:class:`~django.forms.NumberInput` when :attr:`~django.forms.Field.localize`
-is ``False`` or :class:`~django.forms.TextInput` otherwise.
+databases supported by Django.
+
+It uses :class:`~django.core.validators.MinValueValidator` and
+:class:`~django.core.validators.MaxValueValidator` to validate the input based
+on the values that the default database supports.
+
+The default form widget for this field is a :class:`~django.forms.NumberInput`
+when :attr:`~django.forms.Field.localize` is ``False`` or
+:class:`~django.forms.TextInput` otherwise.
``GenericIPAddressField``
-------------------------
@@ -1050,6 +1068,9 @@ It is often useful to automatically prepopulate a SlugField based on the value
of some other value. You can do this automatically in the admin using
:attr:`~django.contrib.admin.ModelAdmin.prepopulated_fields`.
+It uses :class:`~django.core.validators.validate_slug` or
+:class:`~django.core.validators.validate_unicode_slug` for validation.
+
.. attribute:: SlugField.allow_unicode
If ``True``, the field accepts Unicode letters in addition to ASCII
@@ -1093,7 +1114,8 @@ The admin adds some JavaScript shortcuts.
.. class:: URLField(max_length=200, **options)
-A :class:`CharField` for a URL.
+A :class:`CharField` for a URL, validated by
+:class:`~django.core.validators.URLValidator`.
The default form widget for this field is a :class:`~django.forms.TextInput`.