[forms] EntityFieldsForm now take extra mainentity argument, for usage with composite form (the main form) where one of the subform edits the main entity stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Thu, 27 Jan 2011 13:42:51 +0100
branchstable
changeset 6906 5f13aefb470b
parent 6905 fe9fd048e64c
child 6907 449e5b46ed3d
[forms] EntityFieldsForm now take extra mainentity argument, for usage with composite form (the main form) where one of the subform edits the main entity
web/views/forms.py
--- a/web/views/forms.py	Thu Jan 27 13:41:00 2011 +0100
+++ b/web/views/forms.py	Thu Jan 27 13:42:51 2011 +0100
@@ -286,7 +286,8 @@
         super(EntityFieldsForm, self).__init__(_cw, rset, row, col, **kwargs)
         self.add_hidden('__type', self.edited_entity.__regid__, eidparam=True)
         self.add_hidden('eid', self.edited_entity.eid)
-        if kwargs.get('mainform', True): # mainform default to true in parent
+        # mainform default to true in parent, hence default to True
+        if kwargs.get('mainform', True) or kwargs.get('mainentity', False):
             self.add_hidden(u'__maineid', self.edited_entity.eid)
             # If we need to directly attach the new object to another one
             if self._cw.list_form_param('__linkto'):