introduced to ease overriding for fancy stuff... stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Fri, 18 Sep 2009 19:51:45 +0200
branchstable
changeset 3332 91cff87c368f
parent 3331 8e63b72287b1
child 3333 c61a526b530e
child 3334 8d831c02da9a
introduced to ease overriding for fancy stuff...
web/views/autoform.py
--- a/web/views/autoform.py	Fri Sep 18 19:51:27 2009 +0200
+++ b/web/views/autoform.py	Fri Sep 18 19:51:45 2009 +0200
@@ -311,6 +311,14 @@
         """
         return not existant or card in '+*'
 
+    def should_hide_add_new_relation_link(self, rschema, card):
+        """return true if once an inlined creation form is added, the 'add new'
+        link should be hidden
+
+        by default true if the relation has single cardinality
+        """
+        return card in '1?'
+
 
 def etype_relation_field(etype, rtype, role='subject'):
     eschema = AutomaticEntityForm.schema.eschema(etype)