Commit 69e32966 authored by sylvain.thenault@logilab.fr's avatar sylvain.thenault@logilab.fr
Browse files

insert an optgroup as separator on None values

--HG--
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'))
else:
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