Skip to content

Commit b8ccb99

Browse files
committed
Address comments 2
1 parent a780018 commit b8ccb99

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

localized_fields/fields/boolean_field.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ def get_prep_value(self, value: LocalizedBooleanValue) -> dict:
5656
# make sure all values are proper values to be converted to bool
5757
for lang_code, _ in settings.LANGUAGES:
5858
local_value = prepped_value[lang_code]
59-
print(type(local_value))
6059

6160
if local_value is not None and local_value.lower() not in (
6261
"false",

localized_fields/value.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,14 @@ def __bool__(self):
242242
"""Gets the value in the current language as a boolean."""
243243
value = self.translate()
244244

245-
return value
245+
if value is None:
246+
return self.default_value
247+
elif isinstance(value, bool):
248+
return value
249+
250+
if value.lower() == "true":
251+
return True
252+
return False
246253

247254
def __str__(self):
248255
"""Returns string representation of value."""

0 commit comments

Comments
 (0)