web/form.py
branchtls-sprint
changeset 1073 e4342c74ed2d
parent 1072 e36f2889e1bd
child 1081 f2a85f52b9e5
equal deleted inserted replaced
1072:e36f2889e1bd 1073:e4342c74ed2d
  1189         for field in form.fields:
  1189         for field in form.fields:
  1190             if not field.is_visible():
  1190             if not field.is_visible():
  1191                 w(field.render(form, self))
  1191                 w(field.render(form, self))
  1192                 fields.remove(field)
  1192                 fields.remove(field)
  1193         if fields:
  1193         if fields:
       
  1194             self._render_fields(fields, w, form, display_help)
       
  1195         for childform in getattr(form, 'forms', []):
       
  1196             self.render_fields(w, childform, values)
       
  1197             
       
  1198     def _render_fields(self, fields, w, form, display_help):
  1194             w(u'<table>')
  1199             w(u'<table>')
  1195             for field in fields:
  1200             for field in fields:
  1196                 w(u'<tr>')
  1201                 w(u'<tr>')
  1197                 w('<th>%s</th>' % self.render_label(form, field))
  1202                 w(u'<th>%s</th>' % self.render_label(form, field))
  1198                 w(u'<td style="width:100%;">')
  1203                 w(u'<td style="width:100%;">')
  1199                 w(field.render(form, self))
  1204                 w(field.render(form, self))
  1200                 if display_help == True:
  1205                 if display_help == True:
  1201                     w(self.render_help(form, field))
  1206                     w(self.render_help(form, field))
  1202                 w(u'</td></tr>')
  1207                 w(u'</td></tr>')
  1203             w(u'</table>')
  1208             w(u'</table>')
  1204         for childform in getattr(form, 'forms', []):
  1209 
  1205             self.render_fields(w, childform, values)
  1210     button_bar_class = u'formButtonBar'
  1206         
  1211     
  1207     def render_buttons(self, w, form):
  1212     def render_buttons(self, w, form):
  1208         w(u'<table class="formButtonBar">\n<tr>\n')
  1213         w(u'<table class="%s">\n<tr>\n' % self.button_bar_class)
  1209         for button in form.form_buttons():
  1214         for button in form.form_buttons():
  1210             w(u'<td>%s</td>\n' % button)
  1215             w(u'<td>%s</td>\n' % button)
  1211         w(u'</tr></table>')
  1216         w(u'</tr></table>')
  1212 
  1217 
  1213 
  1218