2014-03-14 17:34:49 +00:00
|
|
|
==========
|
|
|
|
Validators
|
|
|
|
==========
|
|
|
|
|
|
|
|
.. module:: django.contrib.postgres.validators
|
|
|
|
|
2018-12-24 21:36:00 +00:00
|
|
|
These validators are available from the ``django.contrib.postgres.validators``
|
|
|
|
module.
|
|
|
|
|
2014-03-14 17:34:49 +00:00
|
|
|
``KeysValidator``
|
2016-01-03 10:56:22 +00:00
|
|
|
=================
|
2014-03-14 17:34:49 +00:00
|
|
|
|
|
|
|
.. class:: KeysValidator(keys, strict=False, messages=None)
|
|
|
|
|
|
|
|
Validates that the given keys are contained in the value. If ``strict`` is
|
|
|
|
``True``, then it also checks that there are no other keys present.
|
|
|
|
|
|
|
|
The ``messages`` passed should be a dict containing the keys
|
|
|
|
``missing_keys`` and/or ``extra_keys``.
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
Note that this checks only for the existence of a given key, not that
|
|
|
|
the value of a key is non-empty.
|
2015-01-10 16:14:20 +00:00
|
|
|
|
|
|
|
Range validators
|
2016-01-03 10:56:22 +00:00
|
|
|
================
|
2015-01-10 16:14:20 +00:00
|
|
|
|
2016-01-24 21:26:11 +00:00
|
|
|
``RangeMaxValueValidator``
|
|
|
|
--------------------------
|
|
|
|
|
2015-01-10 16:14:20 +00:00
|
|
|
.. class:: RangeMaxValueValidator(limit_value, message=None)
|
|
|
|
|
|
|
|
Validates that the upper bound of the range is not greater than
|
|
|
|
``limit_value``.
|
|
|
|
|
2016-01-24 21:26:11 +00:00
|
|
|
``RangeMinValueValidator``
|
|
|
|
--------------------------
|
|
|
|
|
2015-01-10 16:14:20 +00:00
|
|
|
.. class:: RangeMinValueValidator(limit_value, message=None)
|
|
|
|
|
|
|
|
Validates that the lower bound of the range is not less than the
|
|
|
|
``limit_value``.
|