2014-03-15 01:34:49 +08:00
|
|
|
==========
|
|
|
|
Validators
|
|
|
|
==========
|
|
|
|
|
|
|
|
.. module:: django.contrib.postgres.validators
|
|
|
|
|
|
|
|
``KeysValidator``
|
2016-01-03 18:56:22 +08:00
|
|
|
=================
|
2014-03-15 01:34:49 +08: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-11 00:14:20 +08:00
|
|
|
|
|
|
|
Range validators
|
2016-01-03 18:56:22 +08:00
|
|
|
================
|
2015-01-11 00:14:20 +08:00
|
|
|
|
2016-01-25 05:26:11 +08:00
|
|
|
``RangeMaxValueValidator``
|
|
|
|
--------------------------
|
|
|
|
|
2015-01-11 00:14:20 +08:00
|
|
|
.. class:: RangeMaxValueValidator(limit_value, message=None)
|
|
|
|
|
|
|
|
Validates that the upper bound of the range is not greater than
|
|
|
|
``limit_value``.
|
|
|
|
|
2016-01-25 05:26:11 +08:00
|
|
|
``RangeMinValueValidator``
|
|
|
|
--------------------------
|
|
|
|
|
2015-01-11 00:14:20 +08:00
|
|
|
.. class:: RangeMinValueValidator(limit_value, message=None)
|
|
|
|
|
|
|
|
Validates that the lower bound of the range is not less than the
|
|
|
|
``limit_value``.
|