web/views/autoform.py
changeset 9990 c84ad981fc4a
parent 9897 fa44db7da2dc
parent 9976 457efde98629
child 10163 4001cfe2f44d
--- a/web/views/autoform.py	Tue Sep 23 17:34:36 2014 +0200
+++ b/web/views/autoform.py	Thu Sep 25 15:49:13 2014 +0200
@@ -844,9 +844,9 @@
             return [(schema[rtype], role) for rtype, role in self.display_fields]
         if self.edited_entity.has_eid() and not self.edited_entity.cw_has_perm('update'):
             return []
-        # XXX we should simply put eid in the generated section, no?
+        action = 'update' if self.edited_entity.has_eid() else 'add'
         return [(rtype, role) for rtype, _, role in self._relations_by_section(
-            'attributes', 'update', strict)]
+            'attributes', action, strict)]
 
     def editable_relations(self):
         """return a sorted list of (relation's label, relation'schema, role) for
@@ -988,7 +988,7 @@
 
 _AFS = uicfg.autoform_section
 # use primary and not generated for eid since it has to be an hidden
-_AFS.tag_attribute(('*', 'eid'), 'main', 'attributes')
+_AFS.tag_attribute(('*', 'eid'), 'main', 'hidden')
 _AFS.tag_attribute(('*', 'eid'), 'muledit', 'attributes')
 _AFS.tag_attribute(('*', 'description'), 'main', 'attributes')
 _AFS.tag_attribute(('*', 'has_text'), 'main', 'hidden')