| 1 |
========== |
| 2 |
Validators |
| 3 |
========== |
| 4 |
|
| 5 |
.. module:: django.contrib.postgres.validators |
| 6 |
|
| 7 |
These validators are available from the ``django.contrib.postgres.validators`` |
| 8 |
module. |
| 9 |
|
| 10 |
``KeysValidator`` |
| 11 |
================= |
| 12 |
|
| 13 |
.. class:: KeysValidator(keys, strict=False, messages=None) |
| 14 |
|
| 15 |
Validates that the given keys are contained in the value. If ``strict`` is |
| 16 |
``True``, then it also checks that there are no other keys present. |
| 17 |
|
| 18 |
The ``messages`` passed should be a dict containing the keys |
| 19 |
``missing_keys`` and/or ``extra_keys``. |
| 20 |
|
| 21 |
.. note:: |
| 22 |
Note that this checks only for the existence of a given key, not that |
| 23 |
the value of a key is non-empty. |
| 24 |
|
| 25 |
Range validators |
| 26 |
================ |
| 27 |
|
| 28 |
``RangeMaxValueValidator`` |
| 29 |
-------------------------- |
| 30 |
|
| 31 |
.. class:: RangeMaxValueValidator(limit_value, message=None) |
| 32 |
|
| 33 |
Validates that the upper bound of the range is not greater than |
| 34 |
``limit_value``. |
| 35 |
|
| 36 |
``RangeMinValueValidator`` |
| 37 |
-------------------------- |
| 38 |
|
| 39 |
.. class:: RangeMinValueValidator(limit_value, message=None) |
| 40 |
|
| 41 |
Validates that the lower bound of the range is not less than the |
| 42 |
``limit_value``. |