diff options
| author | Jack Linke <jacklinke@gmail.com> | 2022-10-03 01:57:24 -0400 |
|---|---|---|
| committer | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2022-10-05 09:41:01 +0200 |
| commit | 344d31c7e9ede4088e85c859f488d7a926918ec0 (patch) | |
| tree | 42bd5e77a2d9a75103bd4b60cb3f242ef85a9489 | |
| parent | a142edcc4981bb27f4356acad0c7fdfb2d5f9849 (diff) | |
Fixed #34071 -- Improved error message for Range(Min/Max)ValueValidator.
| -rw-r--r-- | django/contrib/postgres/validators.py | 4 | ||||
| -rw-r--r-- | tests/postgres_tests/test_ranges.py | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/django/contrib/postgres/validators.py b/django/contrib/postgres/validators.py index 47bb7bc7b6..638dcff60a 100644 --- a/django/contrib/postgres/validators.py +++ b/django/contrib/postgres/validators.py @@ -78,7 +78,7 @@ class RangeMaxValueValidator(MaxValueValidator): return a.upper is None or a.upper > b message = _( - "Ensure that this range is completely less than or equal to %(limit_value)s." + "Ensure that the upper bound of the range is not greater than %(limit_value)s." ) @@ -87,5 +87,5 @@ class RangeMinValueValidator(MinValueValidator): return a.lower is None or a.lower < b message = _( - "Ensure that this range is completely greater than or equal to %(limit_value)s." + "Ensure that the lower bound of the range is not less than %(limit_value)s." ) diff --git a/tests/postgres_tests/test_ranges.py b/tests/postgres_tests/test_ranges.py index 7f8fc6bb8c..870039a6ad 100644 --- a/tests/postgres_tests/test_ranges.py +++ b/tests/postgres_tests/test_ranges.py @@ -631,7 +631,7 @@ class TestValidators(PostgreSQLSimpleTestCase): def test_max(self): validator = RangeMaxValueValidator(5) validator(NumericRange(0, 5)) - msg = "Ensure that this range is completely less than or equal to 5." + msg = "Ensure that the upper bound of the range is not greater than 5." with self.assertRaises(exceptions.ValidationError) as cm: validator(NumericRange(0, 10)) self.assertEqual(cm.exception.messages[0], msg) @@ -642,7 +642,7 @@ class TestValidators(PostgreSQLSimpleTestCase): def test_min(self): validator = RangeMinValueValidator(5) validator(NumericRange(10, 15)) - msg = "Ensure that this range is completely greater than or equal to 5." + msg = "Ensure that the lower bound of the range is not less than 5." with self.assertRaises(exceptions.ValidationError) as cm: validator(NumericRange(0, 10)) self.assertEqual(cm.exception.messages[0], msg) |
