diff options
| author | Jon Dufresne <jon.dufresne@gmail.com> | 2016-07-21 17:16:22 -0700 |
|---|---|---|
| committer | Tim Graham <timograham@gmail.com> | 2016-08-01 10:36:17 -0400 |
| commit | ac3aaaa740dcf9c6efd2f88ee9219c1924c7695e (patch) | |
| tree | 72e8a094b6f88f60e80397eaf00ce52feb46ed6f /django/forms/widgets.py | |
| parent | aad46c3e370e105f9117a337924090d05f1b001d (diff) | |
Fixed #26927 -- Made subwidget iteration pass disabled and required attributes.
Diffstat (limited to 'django/forms/widgets.py')
| -rw-r--r-- | django/forms/widgets.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py index 604a6a401a..217f37b022 100644 --- a/django/forms/widgets.py +++ b/django/forms/widgets.py @@ -787,6 +787,13 @@ class CheckboxSelectMultiple(RendererMixin, SelectMultiple): renderer = CheckboxFieldRenderer _empty_value = [] + def build_attrs(self, extra_attrs=None, **kwargs): + attrs = super(CheckboxSelectMultiple, self).build_attrs(extra_attrs, **kwargs) + # Remove the 'required' attribute because browser validation would + # require all checkboxes to be checked instead of at least one. + attrs.pop('required', None) + return attrs + class MultiWidget(Widget): """ |
