web/views/formrenderers.py
changeset 6366 1806148d6ce8
parent 6082 57933567146f
parent 6357 2d277c67f103
child 6453 7fdd780d87e4
--- a/web/views/formrenderers.py	Thu Sep 23 23:28:58 2010 +0200
+++ b/web/views/formrenderers.py	Wed Sep 29 16:16:32 2010 +0200
@@ -342,8 +342,14 @@
     def render_fields(self, w, form, values):
         if form.parent_form is None:
             w(u'<table class="listing">')
-            subfields = [field for field in form.forms[0].fields
-                         if field.is_visible()]
+            # get fields from the first subform with something to display (we
+            # may have subforms with nothing editable that will simply be
+            # skipped later)
+            for subform in form.forms:
+                subfields = [field for field in subform.fields
+                             if field.is_visible()]
+                if subfields:
+                    break
             if subfields:
                 # main form, display table headers
                 w(u'<tr class="header">')