merge stable
authorFlorent <florent@secondweb.fr>
Mon, 18 May 2009 10:09:06 +0200
branchstable
changeset 1833 c50245fb9ac2
parent 1828 e9e8beb06f01 (current diff)
parent 1832 3384264d25cc (diff)
child 1834 c153913924a5
merge
--- a/web/formwidgets.py	Fri May 15 14:00:43 2009 +0200
+++ b/web/formwidgets.py	Mon May 18 10:09:06 2009 +0200
@@ -199,26 +199,6 @@
 
     def render(self, form, field):
         name, curvalues, attrs = self._render_attrs(form, field)
-        options = []
-        for label, value in field.vocabulary(form):
-            if value in curvalues:
-                tag = tags.input(name=name, value=value, type=self.type,
-                                 checked='checked', **attrs)
-            else:
-                tag = tags.input(name=name, value=value, type=self.type,
-                                 **attrs)
-            options.append(tag + label)
-        return '<br/>\n'.join(options)
-
-
-class Radio(Input):
-    """<input type='radio'>, for field having a specific vocabulary. One
-    input will be generated for each possible value.
-    """
-    type = 'radio'
-
-    def render(self, form, field):
-        name, curvalues, attrs = self._render_attrs(form, field)
         domid = attrs.pop('id', None)
         options = []
         for i, (label, value) in enumerate(field.vocabulary(form)):
@@ -232,6 +212,12 @@
         return '\n'.join(options)
 
 
+class Radio(CheckBox):
+    """<input type='radio'>, for field having a specific vocabulary. One
+    input will be generated for each possible value.
+    """
+    type = 'radio'
+
 # javascript widgets ###########################################################
 
 class DateTimePicker(TextInput):