undo unnecessary change

This commit is contained in:
Nancy Eckenthal 2023-05-03 19:23:35 -04:00
parent ad4ec1b1e9
commit 7704a244d6

View File

@ -713,15 +713,13 @@ class BooleanField(Field):
return value return value
def to_internal_value(self, data): def to_internal_value(self, data):
try: with contextlib.suppress(TypeError):
if self._lower_if_str(data) in self.TRUE_VALUES: if self._lower_if_str(data) in self.TRUE_VALUES:
return True return True
elif self._lower_if_str(data) in self.FALSE_VALUES: elif self._lower_if_str(data) in self.FALSE_VALUES:
return False return False
elif self._lower_if_str(data) in self.NULL_VALUES and self.allow_null: elif self._lower_if_str(data) in self.NULL_VALUES and self.allow_null:
return None return None
except TypeError: # Input is an unhashable type
pass
self.fail("invalid", input=data) self.fail("invalid", input=data)
def to_representation(self, value): def to_representation(self, value):