Commit 69e32966 authored by's avatar
Browse files

insert an optgroup as separator on None values

branch : tls-sprint
parent 1ad1a174da77
......@@ -167,7 +167,10 @@ class Select(FieldWidget):
name, curvalues, attrs = self._render_attrs(form, field)
options = []
for label, value in field.vocabulary(form):
if value in curvalues:
if value is None:
# handle separator
options.append(u'<optgroup label="%s"/>' % (label or ''))
elif value in curvalues:
options.append(tags.option(label, value=value, selected='selected'))
options.append(tags.option(label, value=value))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment