display_fields should search for name+role tls-sprint
authorsylvain.thenault@logilab.fr
Thu, 30 Apr 2009 12:35:49 +0200
branchtls-sprint
changeset 1576 3bfcf1e4eb26
parent 1575 5eb02a4a4bcf
child 1577 25b46db3cb81
display_fields should search for name+role
web/formrenderers.py
web/views/editforms.py
--- a/web/formrenderers.py	Thu Apr 30 10:46:50 2009 +0200
+++ b/web/formrenderers.py	Thu Apr 30 12:35:49 2009 +0200
@@ -146,8 +146,8 @@
 
     def display_field(self, form, field):
         return (self.display_fields is None
-                or field.name in self.display_fields
-                or field.name in form.internal_fields)
+                or (field.name, field.role) in self.display_fields
+                or (field.name, field.role) in form.internal_fields)
 
     def render_fields(self, w, form, values):
         form.form_build_context(values)
--- a/web/views/editforms.py	Thu Apr 30 10:46:50 2009 +0200
+++ b/web/views/editforms.py	Thu Apr 30 12:35:49 2009 +0200
@@ -104,10 +104,12 @@
             return
         eid = entity.eid
         divid = 'd%s' % make_uid('%s-%s' % (rtype, eid))
-        event_data = {'divid' : divid, 'eid' : eid, 'rtype' : rtype, 'reload' : dumps(reload)}
+        event_data = {'divid' : divid, 'eid' : eid, 'rtype' : rtype,
+                      'reload' : dumps(reload)}
         buttons = [SubmitButton(stdmsgs.BUTTON_OK),
                    Button(stdmsgs.BUTTON_CANCEL,
-                          onclick="cancelInlineEdit(%s,\'%s\',\'%s\')" % (eid, rtype, divid))]
+                          onclick="cancelInlineEdit(%s,\'%s\',\'%s\')" % (
+                              eid, rtype, divid))]
         form = self.vreg.select_object('forms', 'edition', self.req, self.rset,
                                        row=row, col=col, form_buttons=buttons,
                                        domid='%s-form' % divid, action='#',
@@ -115,7 +117,8 @@
                                        onsubmit=self.onsubmit % event_data)
         form.form_add_hidden(u'__maineid', entity.eid)
         renderer = FormRenderer(display_label=False, display_help=False,
-                                display_fields=(rtype,), button_bar_class='buttonbar',
+                                display_fields=[(rtype, role)],
+                                button_bar_class='buttonbar',
                                 display_progress_div=False)
         self.w(tags.div(value, klass='editableField', id=divid,
                         ondblclick=self.ondblclick % event_data))