summaryrefslogtreecommitdiff
path: root/docs/ref/validators.txt
diff options
context:
space:
mode:
authorAlejandro Zamora <azamora@machinalis.com>2017-06-23 12:06:08 -0300
committerTim Graham <timograham@gmail.com>2017-08-12 20:14:14 -0400
commit90d7b912b9c451dfdfb38f5f1f598af3b879257f (patch)
tree7b326aa7e992124ab2ab5fc2dbc9cafdfa79fc90 /docs/ref/validators.txt
parentb78d100fa62cd4fbbc70f2bae77c192cb36c1ccd (diff)
Fixed #28201 -- Added ProhibitNullCharactersValidator and used it on CharField form field.
Diffstat (limited to 'docs/ref/validators.txt')
-rw-r--r--docs/ref/validators.txt24
1 files changed, 24 insertions, 0 deletions
diff --git a/docs/ref/validators.txt b/docs/ref/validators.txt
index 0136fb45a3..f15fcfac2f 100644
--- a/docs/ref/validators.txt
+++ b/docs/ref/validators.txt
@@ -304,3 +304,27 @@ to, or in lieu of custom ``field.clean()`` methods.
Uses Pillow to ensure that ``value.name`` (``value`` is a
:class:`~django.core.files.File`) has `a valid image extension
<https://pillow.readthedocs.io/en/latest/handbook/image-file-formats.html>`_.
+
+``ProhibitNullCharactersValidator``
+-----------------------------------
+
+.. class:: ProhibitNullCharactersValidator(message=None, code=None)
+
+ .. versionadded:: 2.0
+
+ Raises a :exc:`~django.core.exceptions.ValidationError` if ``str(value)``
+ contains one or more nulls characters (``'\x00'``).
+
+ :param message: If not ``None``, overrides :attr:`.message`.
+ :param code: If not ``None``, overrides :attr:`code`.
+
+ .. attribute:: message
+
+ The error message used by
+ :exc:`~django.core.exceptions.ValidationError` if validation fails.
+ Defaults to ``"Null characters are not allowed."``.
+
+ .. attribute:: code
+
+ The error code used by :exc:`~django.core.exceptions.ValidationError`
+ if validation fails. Defaults to ``"null_characters_not_allowed"``.