mirror of
https://github.com/django/django.git
synced 2025-11-07 07:15:35 +00:00
[1.11.x] Fixed #28058 -- Restored empty BoundFields evaluating to True.
Regression inb52c73008aBackport ofc09bf8d767from master
This commit is contained in:
@@ -745,6 +745,13 @@ Java</label></li>
|
||||
[str(bf[1]), str(bf[2]), str(bf[3])],
|
||||
)
|
||||
|
||||
def test_boundfield_bool(self):
|
||||
"""BoundField without any choices (subwidgets) evaluates to True."""
|
||||
class TestForm(Form):
|
||||
name = ChoiceField(choices=[])
|
||||
|
||||
self.assertIs(bool(TestForm()['name']), True)
|
||||
|
||||
def test_forms_with_multiple_choice(self):
|
||||
# MultipleChoiceField is a special case, as its data is required to be a list:
|
||||
class SongForm(Form):
|
||||
|
||||
Reference in New Issue
Block a user