--- a/common/tags.py Fri Feb 20 17:20:53 2009 +0100
+++ b/common/tags.py Fri Feb 20 17:38:38 2009 +0100
@@ -15,11 +15,14 @@
label = tag('label')
option = tag('option')
-def select(name, multiple=False, options=[]):
+def select(name, id=None, multiple=False, options=[]):
+ attrs = {}
if multiple:
- html = [u'<select name="%s" multiple="multiple">' % name]
- else:
- html = [u'<select name="%s">' % name]
+ attrs['multiple'] = 'multiple'
+ if id:
+ attrs['id'] = id
+ html = [u'<select name="%s" %s>' % (name,
+ ' '.join('%s="%s"' % kv for kv in attrs.items()))]
html += options
html.append(u'</select>')
return u'\n'.join(html)