diff options
Diffstat (limited to 'django')
| -rw-r--r-- | django/forms/boundfield.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/django/forms/boundfield.py b/django/forms/boundfield.py index a1063b2b05..a8e81afe9b 100644 --- a/django/forms/boundfield.py +++ b/django/forms/boundfield.py @@ -57,6 +57,13 @@ class BoundField(object): for widget in self.field.widget.subwidgets(self.html_name, self.value(), attrs=attrs) ) + def __bool__(self): + # BoundField evaluates to True even if it doesn't have subwidgets. + return True + + def __nonzero__(self): # Python 2 compatibility + return type(self).__bool__(self) + def __iter__(self): return iter(self.subwidgets) |
