summaryrefslogtreecommitdiff
path: root/django/forms/widgets.py
diff options
context:
space:
mode:
authorBaptiste Mispelon <bmispelon@gmail.com>2013-04-07 10:37:38 +0200
committerClaude Paroz <claude@2xlibre.net>2013-04-13 11:09:47 +0200
commit844fbc85c1d419ed7ecbb7208bd392c1770ea72d (patch)
tree2138cb0b0d8a8a1af3c7b5ec049caa2d64bb7c2f /django/forms/widgets.py
parent3f05c70be065fd915d2cddc1e7f74d1d4cb1e54e (diff)
Fixed #19874: Apply id attribute to the outer <ul> of CheckboxSelectMultiple
Diffstat (limited to 'django/forms/widgets.py')
-rw-r--r--django/forms/widgets.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/django/forms/widgets.py b/django/forms/widgets.py
index ba6f9c5b9a..41263b0905 100644
--- a/django/forms/widgets.py
+++ b/django/forms/widgets.py
@@ -690,7 +690,8 @@ class CheckboxSelectMultiple(SelectMultiple):
if value is None: value = []
final_attrs = self.build_attrs(attrs, name=name)
id_ = final_attrs.get('id', None)
- output = ['<ul>']
+ start_tag = format_html('<ul id="{0}">', id_) if id_ else '<ul>'
+ output = [start_tag]
# Normalize to strings
str_values = set([force_text(v) for v in value])
for i, (option_value, option_label) in enumerate(chain(self.choices, choices)):