summaryrefslogtreecommitdiff
path: root/django/contrib/postgres/validators.py
diff options
context:
space:
mode:
authorImran Iqbal <iqbalmy@hotmail.com>2017-10-31 00:03:52 +0000
committerTim Graham <timograham@gmail.com>2017-11-07 15:07:03 -0500
commit3e7497a05e7f7cf0ff157d88cef18e95e3cff57b (patch)
tree0469a2627d89aecfbd94c9c50cf937483fb90822 /django/contrib/postgres/validators.py
parent1b7780ea0802116eeef80b398a0432ac3f0ba9ef (diff)
downloaddjango-3e7497a05e7f7cf0ff157d88cef18e95e3cff57b.tar.gz
Fixed #28758 -- Fixed RangeMax/MinValueValidators crash with unbound ranges.
Diffstat (limited to 'django/contrib/postgres/validators.py')
-rw-r--r--django/contrib/postgres/validators.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/django/contrib/postgres/validators.py b/django/contrib/postgres/validators.py
index 8a4c84fb65..45bf8e1e13 100644
--- a/django/contrib/postgres/validators.py
+++ b/django/contrib/postgres/validators.py
@@ -69,11 +69,11 @@ class KeysValidator:
class RangeMaxValueValidator(MaxValueValidator):
def compare(self, a, b):
- return a.upper > b
+ return a.upper is None or a.upper > b
message = _('Ensure that this range is completely less than or equal to %(limit_value)s.')
class RangeMinValueValidator(MinValueValidator):
def compare(self, a, b):
- return a.lower < b
+ return a.lower is None or a.lower < b
message = _('Ensure that this range is completely greater than or equal to %(limit_value)s.')