[R forms] use a subfields(form) method to get a chance to adapt to context
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 29 Jul 2009 09:08:04 +0200
changeset 2549 3d8c62e5e2d4
parent 2548 6e9d58e04ef9
child 2550 4e009026a0f0
[R forms] use a subfields(form) method to get a chance to adapt to context
web/formfields.py
web/formwidgets.py
--- a/web/formfields.py	Wed Jul 29 09:07:12 2009 +0200
+++ b/web/formfields.py	Wed Jul 29 09:08:04 2009 +0200
@@ -478,6 +478,9 @@
         super(CompoundField, self).__init__(*args, **kwargs)
         self.fields = fields
 
+    def subfields(self, form):
+        return self.fields
+    
     def actual_fields(self, form):
         return [self] + list(self.fields)
 
--- a/web/formwidgets.py	Wed Jul 29 09:07:12 2009 +0200
+++ b/web/formwidgets.py	Wed Jul 29 09:08:04 2009 +0200
@@ -291,9 +291,9 @@
             subst = self.attrs.get('label_input_substitution', '%(label)s %(input)s')
             fields = [subst % {'label': renderer.render_label(form, f),
                               'input': f.render(form, renderer)}
-                      for f in field.fields]
+                      for f in field.subfields(form)]
         else:
-            fields = [f.render(form, renderer) for f in field.fields]
+            fields = [f.render(form, renderer) for f in field.subfields(form)]
         return u'<div>%s</div>' % ' '.join(fields)