1
0
mirror of https://github.com/django/django.git synced 2024-12-22 17:16:24 +00:00

Made translation maps consistent in NullBooleanSelect widget

`format_value` should be consistent with `value_from_datadict` method.
Translation map options "True" and "False" were missing from the
`format_value` method. This change ensures consistency of use between
the methods, as well as practical passing of "True" value to the widget
when rendering.
This commit is contained in:
Marek Filip 2024-06-03 15:10:14 +02:00 committed by Marek Filip
parent adae619426
commit 03e194e647

View File

@ -808,6 +808,8 @@ class NullBooleanSelect(Select):
return {
True: "true",
False: "false",
"True": "true",
"False": "false",
"true": "true",
"false": "false",
# For backwards compatibility with Django < 2.2.
@ -821,9 +823,9 @@ class NullBooleanSelect(Select):
value = data.get(name)
return {
True: True,
False: False,
"True": True,
"False": False,
False: False,
"true": True,
"false": False,
# For backwards compatibility with Django < 2.2.