1
0
mirror of https://github.com/django/django.git synced 2025-10-31 09:41:08 +00:00

[4.1.x] Fixed #33905 -- Fixed CheckConstraint() validation on range fields.

Bug in 667105877e.

Backport of e0ae1363ec from main
This commit is contained in:
David Sanders
2022-08-09 16:16:23 +10:00
committed by Mariusz Felisiak
parent 6b0193146d
commit e215948f0d
3 changed files with 41 additions and 0 deletions

View File

@@ -78,6 +78,9 @@ class RangeField(models.Field):
def _choices_is_value(cls, value):
return isinstance(value, (list, tuple)) or super()._choices_is_value(value)
def get_placeholder(self, value, compiler, connection):
return "%s::{}".format(self.db_type(connection))
def get_prep_value(self, value):
if value is None:
return None