allow easy arbitrary separator between checkbox/ radio widgets stable
authorFlorent <florent@secondweb.fr>
Tue, 19 May 2009 17:05:54 +0200
branchstable
changeset 1873 e96f50e52099
parent 1872 b49fdd5ce8d2
child 1874 8c68a3bb02af
allow easy arbitrary separator between checkbox/ radio widgets
web/formwidgets.py
--- a/web/formwidgets.py	Tue May 19 16:58:25 2009 +0200
+++ b/web/formwidgets.py	Tue May 19 17:05:54 2009 +0200
@@ -200,6 +200,7 @@
     def render(self, form, field):
         name, curvalues, attrs = self._render_attrs(form, field)
         domid = attrs.pop('id', None)
+        sep = attrs.get('separator', u'<br/>')
         options = []
         for i, (label, value) in enumerate(field.vocabulary(form)):
             iattrs = attrs.copy()
@@ -208,7 +209,7 @@
             if value in curvalues:
                 iattrs['checked'] = u'checked'
             tag = tags.input(name=name, type=self.type, value=value, **iattrs)
-            options.append(tag + label + '<br/>')
+            options.append(tag + label + sep)
         return '\n'.join(options)